SHOW:
|
|
- or go back to the newest paste.
1 | --https://github.com/Mokiros/roblox-FE-compatibility | |
2 | if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end | |
3 | local Player,game,owner = owner,game | |
4 | local RealPlayer = Player | |
5 | do print("FE Compatibility code V2 by Mokiros")local RealPlayer=RealPlayer;script.Parent=RealPlayer.Character;local a=function(b)b[1].f[b[2]]=nil end;local c={__index={disconnect=a,Disconnect=a}}local d={__index={Connect=function(b,e)local f=tostring(math.random(0,10000))while b.f[f]do f=tostring(math.random(0,10000))end;b.f[f]=e;return setmetatable({b,f},c)end}}d.__index.connect=d.__index.Connect;local function g()return setmetatable({f={}},d)end;local h={Hit=CFrame.new(),KeyUp=g(),KeyDown=g(),Button1Up=g(),Button1Down=g(),Button2Up=g(),Button2Down=g()}h.keyUp=h.KeyUp;h.keyDown=h.KeyDown;local i={InputBegan=g(),InputEnded=g()}local CAS={Actions={},BindAction=function(self,j,k,l,...)CAS.Actions[j]=k and{Name=j,Function=k,Keys={...}}or nil end}CAS.UnbindAction=CAS.BindAction;local function m(self,n,...)for o,e in pairs(self[n].f)do e(...)end end;h.T=m;i.T=m;local p=Instance.new("RemoteEvent")p.Name="UserInput_Event"p.OnServerEvent:Connect(function(q,r)if q~=RealPlayer then return end;h.Target=r.e;h.Hit=r.d;if not r.f then local s=r.c==Enum.UserInputState.Begin;if r.b==Enum.UserInputType.MouseButton1 then return h:T(s and"Button1Down"or"Button1Up")end;if r.b==Enum.UserInputType.MouseButton2 then return h:T(s and"Button2Down"or"Button2Up")end;for o,t in pairs(CAS.Actions)do for o,u in pairs(t.Keys)do if u==r.a then t.Function(t.Name,r.c,r)end end end;h:T(s and"KeyDown"or"KeyUp",r.a.Name:lower())i:T(s and"InputBegan"or"InputEnded",r,false)end end)p.Parent=NLS([==[local a=script:WaitForChild("UserInput_Event")local b=owner:GetMouse()local c=game:GetService("UserInputService")local d=function(e,f)if f then return end;a:FireServer({a=e.KeyCode,b=e.UserInputType,c=e.UserInputState,d=b.Hit,e=b.Target})end;c.InputBegan:Connect(d)c.InputEnded:Connect(d)local g,h;local i=game:GetService("RunService").Heartbeat;while true do if g~=b.Hit or h~=b.Target then g,h=b.Hit,b.Target;a:FireServer({f=1,Target=h,d=g})end;for j=1,2 do i:Wait()end end]==],script)local v=game;local w={__index=function(self,u)local x=rawget(self,"_RealService")if x then return typeof(x[u])=="function"and function(o,...)return x[u](x,...)end or x[u]end end,__newindex=function(self,u,y)local x=rawget(self,"_RealService")if x then x[u]=y end end}local function z(t,A)t._RealService=typeof(A)=="string"and v:GetService(A)or A;return setmetatable(t,w)end;local B={GetService=function(self,x)return rawget(self,x)or v:GetService(x)end,Players=z({LocalPlayer=z({GetMouse=function(self)return h end},Player)},"Players"),UserInputService=z(i,"UserInputService"),ContextActionService=z(CAS,"ContextActionService"),RunService=z({_btrs={},RenderStepped=v:GetService("RunService").Heartbeat,BindToRenderStep=function(self,j,o,k)self._btrs[j]=self.Heartbeat:Connect(k)end,UnbindFromRenderStep=function(self,j)self._btrs[j]:Disconnect()end},"RunService")}rawset(B.Players,"localPlayer",B.Players.LocalPlayer)B.service=B.GetService;z(B,game)game,owner=B,B.Players.LocalPlayer end | |
6 | ||
7 | -- NOTE (READ!!): This script doesn't work on voidacity's script builder | |
8 | -- since it crashes your game, but it's usable on other | |
9 | -- script builders like fancy dev's or nexure's. | |
10 | -- (it just doesn't work on voidacity only) | |
11 | ||
12 | --[[ | |
13 | ||
14 | ||
15 | ||
16 | ▓▒▒▓▓ ░▓▒▒██▒▒▓█▒▒▓▓ █▒▒▓█▒▒▒▒▒▒▒█▓▒▒▒▒▒▒▒█▒▓▒▒▒▒▒▓█▒▒▒▒▒▒▒█▓▒▒▒▓▒▒▓█▒▒▒▒▒▓▒▓░ | |
17 | ▓ ░█▒ ▓░ ▓▓ ░█ ░█░▒ ▒▒ █░ █ ░ ▒▓ ▓▒ █ ░░ | |
18 | ░░ ░ ▒██░░░ █░ ▓▓ ░░█░ ▓▒ ▒█████░ ▓█████░░ ▓▓ ░█ ▒█░█▓ ▒▓ ░███████▓ ██░ | |
19 | ▓ ▓█▓ ▒▒█ █▒ ░█ ▓▒ ▒█████░ ▓█████░░ ▓▓ ░█ ▒█▓░ ░▓ ▓███████ █▓ | |
20 | ▓ ░░ ▒█ █▒ ░ █░ ░░░░█░ ▓█████░ ▒██░ ▒██▒ ░█ ░ ░███ ▒░ | |
21 | ▒░ ░░ ▓▓ █░ ▓▒ █░ ░░ ░█░ ▓█████░ █░ ░░ ░ █░ ░ ███░ ░▒ | |
22 | ▒░ ▓▓ ▒▓ █░ ▒█ █▒ ░ █ ▓█████░ ▓ █░ ▒▓ █▒ ░ █▒ ▒█▓█████▓ ░▒ | |
23 | ▒░▒░█▒▒█▓ █░ ▓█ ██░ ░ █░ ▓█████░ ▓█████░ ▒█ ░ █▒ ▒█ ░ █▒ ░███▓███▓░ ▒ | |
24 | ░▒░ ▒█▓ ▒▒ ▒█░ ▓▓ ░██ ░▓ ▒ ░ █░ █░ ▒█ ▓▒ ░█ ▒▓ ███ ▓███░ ▒░ | |
25 | ▒░ ░▓██▒░░ ▓▓ █▒ ▒██ ▓▓ ░ ░ ░█░ ░ █░ ▒█ ▓▓ █░ ▒█ █▓░ ░███▒ ░▒ | |
26 | ▒▒ ▒███░▒ ░█ █▓ ░██░ ▒█ ░ █░ ░ █░ ▒█ █▒ ░█ ▓▓ ░█ ░██▓▒ ▓░ | |
27 | ▒▒ ▒██▓▓▒ ▒▓ █░ ▓█▓ █░ ▒█░ █░ ▓▓ ░█░ ▓▒ ░█▒ ▓ ▓█▒░ ▒▒ | |
28 | ▒▒░ █▓ ▓▒░▒█▒░░▓█░░▒█▒▒░░▓▓░▒▒▒░░▒█▒░░░░░░░█▒░▒█▓░░▓█▒░▒█░░░█▓░░▓▒ ▓█░░▒▒ | |
29 | ░▒▒▒░ ▒░░▒▒░░░░░░░░ ▒░░░▒▒▒▒▒▒▒▒░░░░░░░░░░░░░▒▒▒▒▒▒▒▒▒▒░▒▒▒░░░░ ░░░▒░ | |
30 | ASCII Art Generators are cool :) | |
31 | ||
32 | ||
33 | ||
34 | ]] | |
35 | ||
36 | -- Scroll down for changelog... | |
37 | ||
38 | -- ORIGINAL CREATOR: Depr1 | |
39 | ||
40 | -- If this script isn't on pastebin or the user who uploaded this isn't called "Delros12" | |
41 | -- (and yes my pastebin account is Delros12) or the link is not https://pastebin.com/2NNDTLjL | |
42 | -- then this is not the original link of this script. | |
43 | ||
44 | -- The original link of the script gets edited constantly for updates, if you use the original | |
45 | -- link you will be able to enjoy the most recent updates of this script without changing to | |
46 | -- another link which contains updated script. | |
47 | ||
48 | -- Controls: Q to sneak, use the keypad numbers 1-9 to change blocks, | |
49 | -- choose a empty slot if you want to remove a block, E to open creative | |
50 | -- inventory, right-click to destroy a block in your toolbar in creative | |
51 | -- inventory, R to make camera face your character's front or back. | |
52 | ||
53 | -- You will become steve when you use this script, if you die after | |
54 | -- using this script, keep trying to use it or wait 60 seconds | |
55 | -- (it doesn't work at first but eventually it will) | |
56 | ||
57 | -- Enjoy! :) | |
58 | ||
59 | local updateHand = false | |
60 | local Changelog = [[ | |
61 | ||
62 | Redstone coming soon. (not... sorry) | |
63 | Note (Read!): It will be a very long while till this script gets | |
64 | updated again, i stopped updating this since im focusing more on other things | |
65 | like C++ programming and game development, i'm not really that active much | |
66 | in roblox (and if im off im probably programming), so yeah, maybe in a | |
67 | million years i'll come back to update the script again (:P). | |
68 | 09/03/2018: | |
69 | + Added the heart bar. | |
70 | + Added death animation. | |
71 | * Your camera now shakes like in minecraft when hurt. | |
72 | * Toolbar Selection GUI now is accurate. | |
73 | ||
74 | 02/03/2018: | |
75 | * Fixed a bug with the textures. | |
76 | ||
77 | 01/03/2018: | |
78 | + Added a global grid. | |
79 | + Added something that i'm not sure how to describe. | |
80 | * Punching Animation in first person is now more accurate. | |
81 | ||
82 | 17/02/2018: | |
83 | + You can't break your neck anymore (360 head you know) | |
84 | + Added this changelog | |
85 | - Removed the name tag, since it causes it to get banned on | |
86 | some servers for some reason (really voidacity?). | |
87 | * Walking animation is now more accurate | |
88 | ||
89 | Note: It's been a while since i don't update the script, but i'll | |
90 | get back to updating it. | |
91 | ||
92 | 05/02/2018: | |
93 | + Added gravity to sand and gravel (WARNING: Can be laggy!) | |
94 | ||
95 | 04/02/2018: | |
96 | + Added creative inventory | |
97 | + Added 31 blocks (that's a lot, but not near minecraft's level) | |
98 | + Added sprinting (i'll add footsteps and particles later) | |
99 | - Removed Herobrine | |
100 | * Fixed a bug where the hand dissapears if u look down while sneaking | |
101 | * Fixed? (not sure) a bug where if u ran the script you would die | |
102 | ||
103 | 01/02/2018: | |
104 | + Added the hand that appears on minecraft when ur first person | |
105 | + Added a walking animation to the hand | |
106 | + Punching animation added to the hand | |
107 | + Camera bobbing | |
108 | + Sneaking now lowers your camera just like in minecraft | |
109 | + Blocks now have sounds (i chose the ones that are the closest to minecraft sounds) | |
110 | + When a block is broken, particles will fall from it | |
111 | ]] | |
112 | ||
113 | workspace:WaitForChild("Camera"):ClearAllChildren() | |
114 | local RS = game:GetService("RunService").RenderStepped | |
115 | local targetName = game.Players.LocalPlayer.Name | |
116 | local player = game.Players:FindFirstChild(targetName) | |
117 | ||
118 | local creativeInventory = { | |
119 | { | |
120 | name = "Dirt", | |
121 | size = Vector3.new(2.6, 2.6, 2.6), | |
122 | transparency = 0; | |
123 | frontTex = "rbxassetid://152569532", | |
124 | backTex = "rbxassetid://152569532", | |
125 | topTex = "rbxassetid://152569532", | |
126 | bottomTex = "rbxassetid://152569532", | |
127 | leftTex = "rbxassetid://152569532", | |
128 | rightTex = "rbxassetid://152569532", | |
129 | displayTex = "", | |
130 | sound = "rbxassetid://1102186681", | |
131 | soundVol = 1.25, | |
132 | hasGravity = false, | |
133 | objectType = "Block" | |
134 | }, | |
135 | { | |
136 | name = "Grass", | |
137 | size = Vector3.new(2.6, 2.6, 2.6), | |
138 | transparency = 0; | |
139 | frontTex = "rbxassetid://96430337", | |
140 | backTex = "rbxassetid://96430337", | |
141 | topTex = "rbxassetid://96430265", | |
142 | bottomTex = "rbxassetid://179655033", | |
143 | leftTex = "rbxassetid://96430337", | |
144 | rightTex = "rbxassetid://96430337", | |
145 | displayTex = "", | |
146 | sound = "rbxassetid://1102186681", | |
147 | soundVol = 1.25, | |
148 | hasGravity = false, | |
149 | objectType = "Block" | |
150 | }, | |
151 | { | |
152 | name = "Sand", | |
153 | size = Vector3.new(2.6, 2.6, 2.6), | |
154 | transparency = 0; | |
155 | frontTex = "rbxassetid://347007448", | |
156 | backTex = "rbxassetid://347007448", | |
157 | topTex = "rbxassetid://347007448", | |
158 | bottomTex = "rbxassetid://347007448", | |
159 | leftTex = "rbxassetid://347007448", | |
160 | rightTex = "rbxassetid://347007448", | |
161 | displayTex = "", | |
162 | sound = "rbxassetid://1102186681", | |
163 | soundVol = 1.25, | |
164 | hasGravity = true, | |
165 | objectType = "Block" | |
166 | }, | |
167 | { | |
168 | name = "Gravel", | |
169 | size = Vector3.new(2.6, 2.6, 2.6), | |
170 | transparency = 0; | |
171 | frontTex = "rbxassetid://151701568", | |
172 | backTex = "rbxassetid://151701568", | |
173 | topTex = "rbxassetid://151701568", | |
174 | bottomTex = "rbxassetid://151701568", | |
175 | leftTex = "rbxassetid://151701568", | |
176 | rightTex = "rbxassetid://151701568", | |
177 | displayTex = "", | |
178 | sound = "rbxassetid://1102186681", | |
179 | soundVol = 1.25, | |
180 | hasGravity = true, | |
181 | objectType = "Block" | |
182 | }, | |
183 | { | |
184 | name = "Stone", | |
185 | size = Vector3.new(2.6, 2.6, 2.6), | |
186 | transparency = 0; | |
187 | frontTex = "rbxassetid://75880927", | |
188 | backTex = "rbxassetid://75880927", | |
189 | topTex = "rbxassetid://75880927", | |
190 | bottomTex = "rbxassetid://75880927", | |
191 | leftTex = "rbxassetid://75880927", | |
192 | rightTex = "rbxassetid://75880927", | |
193 | displayTex = "", | |
194 | sound = "rbxassetid://1016978163", | |
195 | soundVol = 2, | |
196 | hasGravity = false, | |
197 | objectType = "Block" | |
198 | }, | |
199 | { | |
200 | name = "Diamond Ore", | |
201 | size = Vector3.new(2.6, 2.6, 2.6), | |
202 | transparency = 0; | |
203 | frontTex = "rbxassetid://57928490", | |
204 | backTex = "rbxassetid://57928490", | |
205 | topTex = "rbxassetid://57928490", | |
206 | bottomTex = "rbxassetid://57928490", | |
207 | leftTex = "rbxassetid://57928490", | |
208 | rightTex = "rbxassetid://57928490", | |
209 | displayTex = "", | |
210 | sound = "rbxassetid://1016978163", | |
211 | soundVol = 2, | |
212 | hasGravity = false, | |
213 | objectType = "Block" | |
214 | }, | |
215 | { | |
216 | name = "Diamond Block", | |
217 | size = Vector3.new(2.6, 2.6, 2.6), | |
218 | transparency = 0; | |
219 | frontTex = "rbxassetid://56749955", | |
220 | backTex = "rbxassetid://56749955", | |
221 | topTex = "rbxassetid://56749955", | |
222 | bottomTex = "rbxassetid://56749955", | |
223 | leftTex = "rbxassetid://56749955", | |
224 | rightTex = "rbxassetid://56749955", | |
225 | displayTex = "", | |
226 | sound = "rbxassetid://1016978163", | |
227 | soundVol = 2, | |
228 | hasGravity = false, | |
229 | objectType = "Block" | |
230 | }, | |
231 | { | |
232 | name = "Emerald Block", | |
233 | size = Vector3.new(2.6, 2.6, 2.6), | |
234 | transparency = 0; | |
235 | frontTex = "rbxassetid://152410853", | |
236 | backTex = "rbxassetid://152410853", | |
237 | topTex = "rbxassetid://152410853", | |
238 | bottomTex = "rbxassetid://152410853", | |
239 | leftTex = "rbxassetid://152410853", | |
240 | rightTex = "rbxassetid://152410853", | |
241 | displayTex = "", | |
242 | sound = "rbxassetid://1016978163", | |
243 | soundVol = 2, | |
244 | hasGravity = false, | |
245 | objectType = "Block" | |
246 | }, | |
247 | { | |
248 | name = "Emerald Ore", | |
249 | size = Vector3.new(2.6, 2.6, 2.6), | |
250 | transparency = 0; | |
251 | frontTex = "rbxassetid://152410868", | |
252 | backTex = "rbxassetid://152410868", | |
253 | topTex = "rbxassetid://152410868", | |
254 | bottomTex = "rbxassetid://152410868", | |
255 | leftTex = "rbxassetid://152410868", | |
256 | rightTex = "rbxassetid://152410868", | |
257 | displayTex = "", | |
258 | sound = "rbxassetid://1016978163", | |
259 | soundVol = 2, | |
260 | hasGravity = false, | |
261 | objectType = "Block" | |
262 | }, | |
263 | { | |
264 | name = "Obsidian", | |
265 | size = Vector3.new(2.6, 2.6, 2.6), | |
266 | transparency = 0; | |
267 | frontTex = "rbxassetid://112560322", | |
268 | backTex = "rbxassetid://112560322", | |
269 | topTex = "rbxassetid://112560322", | |
270 | bottomTex = "rbxassetid://112560322", | |
271 | leftTex = "rbxassetid://112560322", | |
272 | rightTex = "rbxassetid://112560322", | |
273 | displayTex = "", | |
274 | sound = "rbxassetid://1016978163", | |
275 | soundVol = 2, | |
276 | hasGravity = false, | |
277 | objectType = "Block" | |
278 | }, | |
279 | { | |
280 | name = "Gold Block", | |
281 | size = Vector3.new(2.6, 2.6, 2.6), | |
282 | transparency = 0; | |
283 | frontTex = "rbxassetid://152572128", | |
284 | backTex = "rbxassetid://152572128", | |
285 | topTex = "rbxassetid://152572128", | |
286 | bottomTex = "rbxassetid://152572128", | |
287 | leftTex = "rbxassetid://152572128", | |
288 | rightTex = "rbxassetid://152572128", | |
289 | displayTex = "", | |
290 | sound = "rbxassetid://1016978163", | |
291 | soundVol = 2, | |
292 | hasGravity = false, | |
293 | objectType = "Block" | |
294 | }, | |
295 | { | |
296 | name = "Gold Ore", | |
297 | size = Vector3.new(2.6, 2.6, 2.6), | |
298 | transparency = 0; | |
299 | frontTex = "rbxassetid://152572121", | |
300 | backTex = "rbxassetid://152572121", | |
301 | topTex = "rbxassetid://152572121", | |
302 | bottomTex = "rbxassetid://152572121", | |
303 | leftTex = "rbxassetid://152572121", | |
304 | rightTex = "rbxassetid://152572121", | |
305 | displayTex = "", | |
306 | sound = "rbxassetid://1016978163", | |
307 | soundVol = 2, | |
308 | hasGravity = false, | |
309 | objectType = "Block" | |
310 | }, | |
311 | { | |
312 | name = "Iron Block", | |
313 | size = Vector3.new(2.6, 2.6, 2.6), | |
314 | transparency = 0; | |
315 | frontTex = "rbxassetid://152572134", | |
316 | backTex = "rbxassetid://152572134", | |
317 | topTex = "rbxassetid://152572134", | |
318 | bottomTex = "rbxassetid://152572134", | |
319 | leftTex = "rbxassetid://152572134", | |
320 | rightTex = "rbxassetid://152572134", | |
321 | displayTex = "", | |
322 | sound = "rbxassetid://1016978163", | |
323 | soundVol = 2, | |
324 | hasGravity = false, | |
325 | objectType = "Block" | |
326 | }, | |
327 | { | |
328 | name = "Iron Ore", | |
329 | size = Vector3.new(2.6, 2.6, 2.6), | |
330 | transparency = 0; | |
331 | frontTex = "rbxassetid://132879562", | |
332 | backTex = "rbxassetid://132879562", | |
333 | topTex = "rbxassetid://132879562", | |
334 | bottomTex = "rbxassetid://132879562", | |
335 | leftTex = "rbxassetid://132879562", | |
336 | rightTex = "rbxassetid://132879562", | |
337 | displayTex = "", | |
338 | sound = "rbxassetid://1016978163", | |
339 | soundVol = 2, | |
340 | hasGravity = false, | |
341 | objectType = "Block" | |
342 | }, | |
343 | { | |
344 | name = "Redstone Block", | |
345 | size = Vector3.new(2.6, 2.6, 2.6), | |
346 | transparency = 0; | |
347 | frontTex = "rbxassetid://136260219", | |
348 | backTex = "rbxassetid://136260219", | |
349 | topTex = "rbxassetid://136260219", | |
350 | bottomTex = "rbxassetid://136260219", | |
351 | leftTex = "rbxassetid://136260219", | |
352 | rightTex = "rbxassetid://136260219", | |
353 | sound = "rbxassetid://1016978163", | |
354 | soundVol = 2, | |
355 | hasGravity = false, | |
356 | objectType = "Block" | |
357 | }, | |
358 | { | |
359 | name = "Redstone Ore", | |
360 | size = Vector3.new(2.6, 2.6, 2.6), | |
361 | transparency = 0; | |
362 | frontTex = "rbxassetid://152572209", | |
363 | backTex = "rbxassetid://152572209", | |
364 | topTex = "rbxassetid://152572209", | |
365 | bottomTex = "rbxassetid://152572209", | |
366 | leftTex = "rbxassetid://152572209", | |
367 | rightTex = "rbxassetid://152572209", | |
368 | displayTex = "", | |
369 | sound = "rbxassetid://1016978163", | |
370 | soundVol = 2, | |
371 | hasGravity = false, | |
372 | objectType = "Block" | |
373 | }, | |
374 | { | |
375 | name = "Coal Block", | |
376 | size = Vector3.new(2.6, 2.6, 2.6), | |
377 | transparency = 0; | |
378 | frontTex = "rbxassetid://152527418", | |
379 | backTex = "rbxassetid://152527418", | |
380 | topTex = "rbxassetid://152527418", | |
381 | bottomTex = "rbxassetid://152527418", | |
382 | leftTex = "rbxassetid://152527418", | |
383 | rightTex = "rbxassetid://152527418", | |
384 | displayTex = "", | |
385 | sound = "rbxassetid://1016978163", | |
386 | soundVol = 2, | |
387 | hasGravity = false, | |
388 | objectType = "Block" | |
389 | }, | |
390 | { | |
391 | name = "Coal Ore", | |
392 | size = Vector3.new(2.6, 2.6, 2.6), | |
393 | transparency = 0; | |
394 | frontTex = "rbxassetid://152572101", | |
395 | backTex = "rbxassetid://152572101", | |
396 | topTex = "rbxassetid://152572101", | |
397 | bottomTex = "rbxassetid://152572101", | |
398 | leftTex = "rbxassetid://152572101", | |
399 | rightTex = "rbxassetid://152572101", | |
400 | displayTex = "", | |
401 | sound = "rbxassetid://1016978163", | |
402 | soundVol = 2, | |
403 | hasGravity = false, | |
404 | objectType = "Block" | |
405 | }, | |
406 | { | |
407 | name = "Bedrock", | |
408 | size = Vector3.new(2.6, 2.6, 2.6), | |
409 | transparency = 0; | |
410 | frontTex = "rbxassetid://75881126", | |
411 | backTex = "rbxassetid://75881126", | |
412 | topTex = "rbxassetid://75881126", | |
413 | bottomTex = "rbxassetid://75881126", | |
414 | leftTex = "rbxassetid://75881126", | |
415 | rightTex = "rbxassetid://75881126", | |
416 | displayTex = "", | |
417 | sound = "rbxassetid://1016978163", | |
418 | soundVol = 2, | |
419 | hasGravity = false, | |
420 | objectType = "Block" | |
421 | }, | |
422 | { | |
423 | name = "Cobblestone", | |
424 | size = Vector3.new(2.6, 2.6, 2.6), | |
425 | transparency = 0; | |
426 | frontTex = "rbxassetid://152572105", | |
427 | backTex = "rbxassetid://152572105", | |
428 | topTex = "rbxassetid://152572105", | |
429 | bottomTex = "rbxassetid://152572105", | |
430 | leftTex = "rbxassetid://152572105", | |
431 | rightTex = "rbxassetid://152572105", | |
432 | displayTex = "", | |
433 | sound = "rbxassetid://1016978163", | |
434 | soundVol = 2, | |
435 | hasGravity = false, | |
436 | objectType = "Block" | |
437 | }, | |
438 | { | |
439 | name = "Mossy Stone Brick", | |
440 | size = Vector3.new(2.6, 2.6, 2.6), | |
441 | transparency = 0; | |
442 | frontTex = "rbxassetid://61826751", | |
443 | backTex = "rbxassetid://61826751", | |
444 | topTex = "rbxassetid://61826751", | |
445 | bottomTex = "rbxassetid://61826751", | |
446 | leftTex = "rbxassetid://61826751", | |
447 | rightTex = "rbxassetid://61826751", | |
448 | displayTex = "", | |
449 | sound = "rbxassetid://1016978163", | |
450 | soundVol = 2, | |
451 | hasGravity = false, | |
452 | objectType = "Block" | |
453 | }, | |
454 | { | |
455 | name = "Cracked Stone Brick", | |
456 | size = Vector3.new(2.6, 2.6, 2.6), | |
457 | transparency = 0; | |
458 | frontTex = "rbxassetid://151802087", | |
459 | backTex = "rbxassetid://151802087", | |
460 | topTex = "rbxassetid://151802087", | |
461 | bottomTex = "rbxassetid://151802087", | |
462 | leftTex = "rbxassetid://151802087", | |
463 | rightTex = "rbxassetid://151802087", | |
464 | displayTex = "", | |
465 | sound = "rbxassetid://1016978163", | |
466 | soundVol = 2, | |
467 | hasGravity = false, | |
468 | objectType = "Block" | |
469 | }, | |
470 | { | |
471 | name = "Chiseled Stone Brick", | |
472 | size = Vector3.new(2.6, 2.6, 2.6), | |
473 | transparency = 0; | |
474 | frontTex = "rbxassetid://151802074", | |
475 | backTex = "rbxassetid://151802074", | |
476 | topTex = "rbxassetid://151802074", | |
477 | bottomTex = "rbxassetid://151802074", | |
478 | leftTex = "rbxassetid://151802074", | |
479 | rightTex = "rbxassetid://151802074", | |
480 | displayTex = "", | |
481 | sound = "rbxassetid://1016978163", | |
482 | soundVol = 2, | |
483 | hasGravity = false, | |
484 | objectType = "Block" | |
485 | }, | |
486 | { | |
487 | name = "Stone Brick", | |
488 | size = Vector3.new(2.6, 2.6, 2.6), | |
489 | transparency = 0; | |
490 | frontTex = "rbxassetid://61826773", | |
491 | backTex = "rbxassetid://61826773", | |
492 | topTex = "rbxassetid://61826773", | |
493 | bottomTex = "rbxassetid://61826773", | |
494 | leftTex = "rbxassetid://61826773", | |
495 | rightTex = "rbxassetid://61826773", | |
496 | displayTex = "", | |
497 | sound = "rbxassetid://1016978163", | |
498 | soundVol = 2, | |
499 | hasGravity = false, | |
500 | objectType = "Block" | |
501 | }, | |
502 | { | |
503 | name = "Nether Brick", | |
504 | size = Vector3.new(2.6, 2.6, 2.6), | |
505 | transparency = 0; | |
506 | frontTex = "rbxassetid://151802104", | |
507 | backTex = "rbxassetid://151802104", | |
508 | topTex = "rbxassetid://151802104", | |
509 | bottomTex = "rbxassetid://151802104", | |
510 | leftTex = "rbxassetid://151802104", | |
511 | rightTex = "rbxassetid://151802104", | |
512 | displayTex = "", | |
513 | sound = "rbxassetid://1016978163", | |
514 | soundVol = 2, | |
515 | hasGravity = false, | |
516 | objectType = "Block" | |
517 | }, | |
518 | { | |
519 | name = "Granite", | |
520 | size = Vector3.new(2.6, 2.6, 2.6), | |
521 | transparency = 0; | |
522 | frontTex = "rbxassetid://151776467", | |
523 | backTex = "rbxassetid://151776467", | |
524 | topTex = "rbxassetid://151776467", | |
525 | bottomTex = "rbxassetid://151776467", | |
526 | leftTex = "rbxassetid://151776467", | |
527 | rightTex = "rbxassetid://151776467", | |
528 | displayTex = "", | |
529 | sound = "rbxassetid://1016978163", | |
530 | soundVol = 2, | |
531 | hasGravity = false, | |
532 | objectType = "Block" | |
533 | }, | |
534 | { | |
535 | name = "Diorite", | |
536 | size = Vector3.new(2.6, 2.6, 2.6), | |
537 | transparency = 0; | |
538 | frontTex = "rbxassetid://151776452", | |
539 | backTex = "rbxassetid://151776452", | |
540 | topTex = "rbxassetid://151776452", | |
541 | bottomTex = "rbxassetid://151776452", | |
542 | leftTex = "rbxassetid://151776452", | |
543 | rightTex = "rbxassetid://151776452", | |
544 | sound = "rbxassetid://1016978163", | |
545 | soundVol = 2, | |
546 | hasGravity = false, | |
547 | objectType = "Block" | |
548 | }, | |
549 | { | |
550 | name = "Andesite", | |
551 | size = Vector3.new(2.6, 2.6, 2.6), | |
552 | transparency = 0; | |
553 | frontTex = "rbxassetid://151776422", | |
554 | backTex = "rbxassetid://151776422", | |
555 | topTex = "rbxassetid://151776422", | |
556 | bottomTex = "rbxassetid://151776422", | |
557 | leftTex = "rbxassetid://151776422", | |
558 | rightTex = "rbxassetid://151776422", | |
559 | displayTex = "", | |
560 | sound = "rbxassetid://1016978163", | |
561 | soundVol = 2, | |
562 | hasGravity = false, | |
563 | objectType = "Block" | |
564 | }, | |
565 | { | |
566 | name = "Polished Granite", | |
567 | size = Vector3.new(2.6, 2.6, 2.6), | |
568 | transparency = 0; | |
569 | frontTex = "rbxassetid://151776506", | |
570 | backTex = "rbxassetid://151776506", | |
571 | topTex = "rbxassetid://151776506", | |
572 | bottomTex = "rbxassetid://151776506", | |
573 | leftTex = "rbxassetid://151776506", | |
574 | rightTex = "rbxassetid://151776506", | |
575 | displayTex = "", | |
576 | sound = "rbxassetid://1016978163", | |
577 | soundVol = 2, | |
578 | hasGravity = false, | |
579 | objectType = "Block" | |
580 | }, | |
581 | { | |
582 | name = "Polished Diorite", | |
583 | size = Vector3.new(2.6, 2.6, 2.6), | |
584 | transparency = 0; | |
585 | frontTex = "rbxassetid://151776533", | |
586 | backTex = "rbxassetid://151776533", | |
587 | topTex = "rbxassetid://151776533", | |
588 | bottomTex = "rbxassetid://151776533", | |
589 | leftTex = "rbxassetid://151776533", | |
590 | rightTex = "rbxassetid://151776533", | |
591 | displayTex = "", | |
592 | sound = "rbxassetid://1016978163", | |
593 | soundVol = 2, | |
594 | hasGravity = false, | |
595 | objectType = "Block" | |
596 | }, | |
597 | { | |
598 | name = "Polished Andesite", | |
599 | size = Vector3.new(2.6, 2.6, 2.6), | |
600 | transparency = 0; | |
601 | frontTex = "rbxassetid://151776506", | |
602 | backTex = "rbxassetid://151776506", | |
603 | topTex = "rbxassetid://151776506", | |
604 | bottomTex = "rbxassetid://151776506", | |
605 | leftTex = "rbxassetid://151776506", | |
606 | rightTex = "rbxassetid://151776506", | |
607 | displayTex = "", | |
608 | sound = "rbxassetid://1016978163", | |
609 | soundVol = 2, | |
610 | hasGravity = false, | |
611 | objectType = "Block" | |
612 | }, | |
613 | { | |
614 | name = "Brick Block", | |
615 | size = Vector3.new(2.6, 2.6, 2.6), | |
616 | transparency = 0; | |
617 | frontTex = "rbxassetid://59389191", | |
618 | backTex = "rbxassetid://59389191", | |
619 | topTex = "rbxassetid://59389191", | |
620 | bottomTex = "rbxassetid://59389191", | |
621 | leftTex = "rbxassetid://59389191", | |
622 | rightTex = "rbxassetid://59389191", | |
623 | displayTex = "", | |
624 | sound = "rbxassetid://1016978163", | |
625 | soundVol = 2, | |
626 | hasGravity = false, | |
627 | objectType = "Block" | |
628 | }, | |
629 | { | |
630 | name = "Packed Ice", | |
631 | size = Vector3.new(2.6, 2.6, 2.6), | |
632 | transparency = 0; | |
633 | frontTex = "rbxassetid://152528023", | |
634 | backTex = "rbxassetid://152528023", | |
635 | topTex = "rbxassetid://152528023", | |
636 | bottomTex = "rbxassetid://152528023", | |
637 | leftTex = "rbxassetid://152528023", | |
638 | rightTex = "rbxassetid://152528023", | |
639 | displayTex = "", | |
640 | sound = "rbxassetid://1016978163", | |
641 | soundVol = 2, | |
642 | hasGravity = false, | |
643 | objectType = "Block" | |
644 | }, | |
645 | { | |
646 | name = "Ice Block", | |
647 | size = Vector3.new(2.6, 2.6, 2.6), | |
648 | transparency = 1; | |
649 | frontTex = "rbxassetid://118555586", | |
650 | backTex = "rbxassetid://118555586", | |
651 | topTex = "rbxassetid://118555586", | |
652 | bottomTex = "rbxassetid://118555586", | |
653 | leftTex = "rbxassetid://118555586", | |
654 | rightTex = "rbxassetid://118555586", | |
655 | displayTex = "", | |
656 | sound = "rbxassetid://1016978163", | |
657 | soundVol = 2, | |
658 | hasGravity = false, | |
659 | objectType = "Block" | |
660 | }, | |
661 | { | |
662 | name = "Netherrack", | |
663 | size = Vector3.new(2.6, 2.6, 2.6), | |
664 | transparency = 0; | |
665 | frontTex = "rbxassetid://151802119", | |
666 | backTex = "rbxassetid://151802119", | |
667 | topTex = "rbxassetid://151802119", | |
668 | bottomTex = "rbxassetid://151802119", | |
669 | leftTex = "rbxassetid://151802119", | |
670 | rightTex = "rbxassetid://151802119", | |
671 | displayTex = "", | |
672 | sound = "rbxassetid://1016978163", | |
673 | soundVol = 2, | |
674 | hasGravity = false, | |
675 | objectType = "Block" | |
676 | }, | |
677 | { | |
678 | name = "End Stone", | |
679 | size = Vector3.new(2.6, 2.6, 2.6), | |
680 | transparency = 0; | |
681 | frontTex = "rbxassetid://151802091", | |
682 | backTex = "rbxassetid://151802091", | |
683 | topTex = "rbxassetid://151802091", | |
684 | bottomTex = "rbxassetid://151802091", | |
685 | leftTex = "rbxassetid://151802091", | |
686 | rightTex = "rbxassetid://151802091", | |
687 | displayTex = "", | |
688 | sound = "rbxassetid://1016978163", | |
689 | soundVol = 2, | |
690 | hasGravity = false, | |
691 | objectType = "Block" | |
692 | }, | |
693 | { | |
694 | name = "Glass Block", | |
695 | size = Vector3.new(2.6, 2.6, 2.6), | |
696 | transparency = 1; | |
697 | frontTex = "rbxassetid://152239003", | |
698 | backTex = "rbxassetid://152239003", | |
699 | topTex = "rbxassetid://152239003", | |
700 | bottomTex = "rbxassetid://152239003", | |
701 | leftTex = "rbxassetid://152239003", | |
702 | rightTex = "rbxassetid://152239003", | |
703 | displayTex = "", | |
704 | sound = "rbxassetid://1016978163", | |
705 | soundVol = 2, | |
706 | hasGravity = false, | |
707 | objectType = "Block" | |
708 | }, | |
709 | { | |
710 | name = "Glowstone", | |
711 | size = Vector3.new(2.6, 2.6, 2.6), | |
712 | transparency = 0; | |
713 | frontTex = "rbxassetid://54790811", | |
714 | backTex = "rbxassetid://54790811", | |
715 | topTex = "rbxassetid://54790811", | |
716 | bottomTex = "rbxassetid://54790811", | |
717 | leftTex = "rbxassetid://54790811", | |
718 | rightTex = "rbxassetid://54790811", | |
719 | displayTex = "", | |
720 | sound = "rbxassetid://1016978163", | |
721 | soundVol = 2, | |
722 | hasGravity = false, | |
723 | objectType = "Block" | |
724 | }, | |
725 | { | |
726 | name = "Bookshelf", | |
727 | size = Vector3.new(2.6, 2.6, 2.6), | |
728 | transparency = 0; | |
729 | frontTex = "rbxassetid://118554092", | |
730 | backTex = "rbxassetid://118554092", | |
731 | topTex = "rbxassetid://346201871", | |
732 | bottomTex = "rbxassetid://346201871", | |
733 | leftTex = "rbxassetid://118554092", | |
734 | rightTex = "rbxassetid://118554092", | |
735 | displayTex = "", | |
736 | sound = "rbxassetid://507863457", | |
737 | soundVol = 2, | |
738 | hasGravity = false, | |
739 | objectType = "Block" | |
740 | }, | |
741 | { | |
742 | name = "Oak Wood Planks", | |
743 | size = Vector3.new(2.6, 2.6, 2.6), | |
744 | transparency = 0; | |
745 | frontTex = "rbxassetid://346201871", | |
746 | backTex = "rbxassetid://346201871", | |
747 | topTex = "rbxassetid://346201871", | |
748 | bottomTex = "rbxassetid://346201871", | |
749 | leftTex = "rbxassetid://346201871", | |
750 | rightTex = "rbxassetid://346201871", | |
751 | displayTex = "", | |
752 | sound = "rbxassetid://507863457", | |
753 | soundVol = 2, | |
754 | hasGravity = false, | |
755 | objectType = "Block" | |
756 | }, | |
757 | { | |
758 | name = "Oak Log", | |
759 | size = Vector3.new(2.6, 2.6, 2.6), | |
760 | transparency = 0; | |
761 | frontTex = "rbxassetid://71445924", | |
762 | backTex = "rbxassetid://71445924", | |
763 | topTex = "rbxassetid://152538557", | |
764 | bottomTex = "rbxassetid://152538557", | |
765 | leftTex = "rbxassetid://71445924", | |
766 | rightTex = "rbxassetid://71445924", | |
767 | displayTex = "", | |
768 | sound = "rbxassetid://507863457", | |
769 | soundVol = 2, | |
770 | hasGravity = false, | |
771 | objectType = "Block" | |
772 | }, | |
773 | { | |
774 | name = "Oak Leaves", | |
775 | size = Vector3.new(2.6, 2.6, 2.6), | |
776 | transparency = 1; | |
777 | frontTex = "rbxassetid://151708391", | |
778 | backTex = "rbxassetid://151708391", | |
779 | topTex = "rbxassetid://151708391", | |
780 | bottomTex = "rbxassetid://151708391", | |
781 | leftTex = "rbxassetid://151708391", | |
782 | rightTex = "rbxassetid://151708391", | |
783 | displayTex = "", | |
784 | sound = "rbxassetid://507863457", | |
785 | -- couldn't find a leaves sound for this one, sorry lol | |
786 | soundVol = 2, | |
787 | hasGravity = false, | |
788 | objectType = "Block" | |
789 | } | |
790 | } | |
791 | local toolBar = { | |
792 | { | |
793 | name = "Dirt Block", | |
794 | size = Vector3.new(2.6, 2.6, 2.6), | |
795 | transparency = 0; | |
796 | frontTex = "rbxassetid://152569532", | |
797 | backTex = "rbxassetid://152569532", | |
798 | topTex = "rbxassetid://152569532", | |
799 | bottomTex = "rbxassetid://152569532", | |
800 | leftTex = "rbxassetid://152569532", | |
801 | rightTex = "rbxassetid://152569532", | |
802 | displayTex = "", | |
803 | sound = "rbxassetid://1102186681", | |
804 | soundVol = 1.25, | |
805 | hasGravity = false, | |
806 | objectType = "Block" | |
807 | }, | |
808 | { | |
809 | name = "Grass Block", | |
810 | size = Vector3.new(2.6, 2.6, 2.6), | |
811 | transparency = 0; | |
812 | frontTex = "rbxassetid://96430337", | |
813 | backTex = "rbxassetid://96430337", | |
814 | topTex = "rbxassetid://96430265", | |
815 | bottomTex = "rbxassetid://179655033", | |
816 | leftTex = "rbxassetid://96430337", | |
817 | rightTex = "rbxassetid://96430337", | |
818 | displayTex = "", | |
819 | sound = "rbxassetid://1102186681", | |
820 | soundVol = 1.25, | |
821 | hasGravity = false, | |
822 | objectType = "Block" | |
823 | }, | |
824 | { | |
825 | name = "Stone", | |
826 | size = Vector3.new(2.6, 2.6, 2.6), | |
827 | transparency = 0; | |
828 | frontTex = "rbxassetid://75880927", | |
829 | backTex = "rbxassetid://75880927", | |
830 | topTex = "rbxassetid://75880927", | |
831 | bottomTex = "rbxassetid://75880927", | |
832 | leftTex = "rbxassetid://75880927", | |
833 | rightTex = "rbxassetid://75880927", | |
834 | displayTex = "", | |
835 | sound = "rbxassetid://1016978163", | |
836 | soundVol = 2, | |
837 | hasGravity = false, | |
838 | objectType = "Block" | |
839 | }, | |
840 | { | |
841 | name = "Diamond Ore", | |
842 | size = Vector3.new(2.6, 2.6, 2.6), | |
843 | transparency = 0; | |
844 | frontTex = "rbxassetid://57928490", | |
845 | backTex = "rbxassetid://57928490", | |
846 | topTex = "rbxassetid://57928490", | |
847 | bottomTex = "rbxassetid://57928490", | |
848 | leftTex = "rbxassetid://57928490", | |
849 | rightTex = "rbxassetid://57928490", | |
850 | displayTex = "", | |
851 | sound = "rbxassetid://1016978163", | |
852 | soundVol = 2, | |
853 | hasGravity = false, | |
854 | objectType = "Block" | |
855 | }, | |
856 | { | |
857 | name = "Diamond Block", | |
858 | size = Vector3.new(2.6, 2.6, 2.6), | |
859 | transparency = 0; | |
860 | frontTex = "rbxassetid://56749955", | |
861 | backTex = "rbxassetid://56749955", | |
862 | topTex = "rbxassetid://56749955", | |
863 | bottomTex = "rbxassetid://56749955", | |
864 | leftTex = "rbxassetid://56749955", | |
865 | rightTex = "rbxassetid://56749955", | |
866 | displayTex = "", | |
867 | sound = "rbxassetid://1016978163", | |
868 | soundVol = 2, | |
869 | hasGravity = false, | |
870 | objectType = "Block" | |
871 | }, | |
872 | { | |
873 | name = "Oak Wood Planks", | |
874 | size = Vector3.new(2.6, 2.6, 2.6), | |
875 | transparency = 0; | |
876 | frontTex = "rbxassetid://346201871", | |
877 | backTex = "rbxassetid://346201871", | |
878 | topTex = "rbxassetid://346201871", | |
879 | bottomTex = "rbxassetid://346201871", | |
880 | leftTex = "rbxassetid://346201871", | |
881 | rightTex = "rbxassetid://346201871", | |
882 | displayTex = "", | |
883 | sound = "rbxassetid://507863457", | |
884 | soundVol = 2, | |
885 | hasGravity = false, | |
886 | objectType = "Block" | |
887 | }, | |
888 | { | |
889 | name = "Oak Log", | |
890 | size = Vector3.new(2.6, 2.6, 2.6), | |
891 | transparency = 0; | |
892 | frontTex = "rbxassetid://71445924", | |
893 | backTex = "rbxassetid://71445924", | |
894 | topTex = "rbxassetid://152538557", | |
895 | bottomTex = "rbxassetid://152538557", | |
896 | leftTex = "rbxassetid://71445924", | |
897 | rightTex = "rbxassetid://71445924", | |
898 | displayTex = "", | |
899 | sound = "rbxassetid://507863457", | |
900 | soundVol = 2, | |
901 | hasGravity = false, | |
902 | objectType = "Block" | |
903 | } | |
904 | --[[{ | |
905 | name = "Redstone", | |
906 | size = Vector3.new(2.6, 0.05, 2.6), | |
907 | transparency = 1; | |
908 | frontTex = "rbxassetid://151911305", | |
909 | backTex = "", | |
910 | topTex = "rbxassetid://151911305", | |
911 | bottomTex = "", | |
912 | leftTex = "", | |
913 | rightTex = "", | |
914 | displayTex = "rbxassetid://64124418", | |
915 | sound = "rbxassetid://1016978163", | |
916 | soundVol = 2, | |
917 | hasGravity = false, | |
918 | objectType = "Redstone Dust" | |
919 | },]] | |
920 | } | |
921 | function putTexture(part, frontF, backF, topF, bottomF, leftF, rightF, className) | |
922 | local faces = {"Front", "Back", "Top", "Bottom", "Left", "Right"} | |
923 | for i,f in pairs(faces) do | |
924 | local decal = Instance.new(className, part) | |
925 | if i == 1 then decal.Texture = frontF decal.Name = f end | |
926 | if i == 2 then decal.Texture = backF or frontF decal.Name = f end | |
927 | if i == 3 then decal.Texture = topF or frontF decal.Name = f end | |
928 | if i == 4 then decal.Texture = bottomF or frontF decal.Name = f end | |
929 | if i == 5 then decal.Texture = leftF or frontF decal.Name = f end | |
930 | if i == 6 then decal.Texture = rightF or frontF decal.Name = f end | |
931 | decal.Face = f | |
932 | end | |
933 | return part | |
934 | end | |
935 | function makeSquare(position, size, color, transparency, parent, zindex) | |
936 | local label = Instance.new("TextLabel", parent) | |
937 | label.Text = "" | |
938 | label.BorderSizePixel = 0 | |
939 | label.BackgroundTransparency = transparency | |
940 | label.Position = position | |
941 | label.Size = size | |
942 | label.BackgroundColor3 = color | |
943 | if zindex == nil then label.ZIndex = 1 else label.ZIndex = zindex end | |
944 | return label | |
945 | end | |
946 | function makeImage(position, size, image, parent, zindex) | |
947 | local imglabel = Instance.new("ImageLabel", parent) | |
948 | imglabel.BorderSizePixel = 0 | |
949 | imglabel.BackgroundTransparency = 1 | |
950 | imglabel.Position = position | |
951 | imglabel.Size = size | |
952 | imglabel.Image = image | |
953 | if zindex == nil then imglabel.ZIndex = 1 else imglabel.ZIndex = zindex end | |
954 | return imglabel | |
955 | end | |
956 | function putInventorySlot(position, image, parent, zindex) | |
957 | local button = Instance.new("TextButton", parent) | |
958 | button.Position = position | |
959 | button.Size = UDim2.new(0, 36, 0, 36) | |
960 | button.BackgroundColor3 = Color3.new(139/255, 139/255, 139/255) | |
961 | button.Text = "" | |
962 | button.BorderSizePixel = 0 | |
963 | button.ZIndex = zindex | |
964 | local imageLabel = Instance.new("ImageLabel", button) | |
965 | imageLabel.BackgroundTransparency = 0.9 | |
966 | imageLabel.Position = UDim2.new(0, 2, 0, 2) | |
967 | imageLabel.Size = UDim2.new(0, 32, 0, 32) | |
968 | imageLabel.Image = image | |
969 | imageLabel.BorderSizePixel = 0 | |
970 | imageLabel.ZIndex = zindex | |
971 | makeSquare(UDim2.new(0, 0, 0, 0), UDim2.new(0, 34, 0, 2), | |
972 | Color3.new(55/255, 55/255, 55/255), 0, button, zindex) | |
973 | makeSquare(UDim2.new(0, 0, 0, 0), UDim2.new(0, 2, 0, 34), | |
974 | Color3.new(55/255, 55/255, 55/255), 0, button, zindex) | |
975 | makeSquare(UDim2.new(0, 34, 0, 2), UDim2.new(0, 2, 0, 34), | |
976 | Color3.new(255/255, 255/255, 255/255), 0, button, zindex) | |
977 | makeSquare(UDim2.new(0, 2, 0, 34), UDim2.new(0, 34, 0, 2), | |
978 | Color3.new(255/255, 255/255, 255/255), 0, button, zindex) | |
979 | return button | |
980 | end | |
981 | ||
982 | function AngleDifference(Angle1, Angle2) | |
983 | local Difference = {X = 0, Y = 0, Z = 0} | |
984 | Difference.X = Angle2.X - Angle1.X | |
985 | ||
986 | if (Difference.X > 180) then | |
987 | Difference.X = Difference.X - 360 | |
988 | elseif (Difference.X < -180) then | |
989 | Difference.X = Difference.X + 360 | |
990 | end | |
991 | ||
992 | Difference.Y = Angle2.Y - Angle1.Y | |
993 | ||
994 | if (Difference.Y > 180) then | |
995 | Difference.Y = Difference.Y - 360 | |
996 | elseif (Difference.Y < -180) then | |
997 | Difference.Y = Difference.Y + 360 | |
998 | end | |
999 | ||
1000 | Difference.Z = Angle2.Z - Angle1.Z | |
1001 | ||
1002 | if (Difference.Z > 180) then | |
1003 | Difference.Z = Difference.Z - 360 | |
1004 | elseif (Difference.Z < -180) then | |
1005 | Difference.Z = Difference.Z + 360 | |
1006 | end | |
1007 | ||
1008 | return Vector3.new(Difference.X, Difference.Y, Difference.Z) | |
1009 | end | |
1010 | ||
1011 | local draggingBlock = nil | |
1012 | function makeInventory() | |
1013 | local playerGui = player:FindFirstChild("PlayerGui") | |
1014 | if playerGui then | |
1015 | local invGui = Instance.new("ScreenGui", playerGui) | |
1016 | local creativeInv = Instance.new("Frame", invGui) | |
1017 | creativeInv.BackgroundTransparency = 1 | |
1018 | creativeInv.Position = UDim2.new(0.5, -170, 0.5, -202) | |
1019 | ||
1020 | creativeInv.Visible = false | |
1021 | ||
1022 | -- creative inventory GUI... | |
1023 | ||
1024 | local blackOut = makeSquare(UDim2.new(0, 0, 0, 0), UDim2.new(1, 0, 1, 0), | |
1025 | Color3.new(0/255, 0/255, 0/255), 0.3, invGui, 1) | |
1026 | blackOut.Visible = false | |
1027 | ||
1028 | creativeInv.Changed:connect(function() | |
1029 | blackOut.Visible = creativeInv.Visible | |
1030 | end) | |
1031 | ||
1032 | local changeLog = Instance.new("TextLabel", invGui) | |
1033 | changeLog.Text = Changelog | |
1034 | changeLog.Font = "SourceSans" | |
1035 | changeLog.FontSize = Enum.FontSize.Size12 | |
1036 | changeLog.Size = UDim2.new(0, changeLog.TextBounds.X, 0, changeLog.TextBounds.Y + 2) | |
1037 | changeLog.BackgroundColor3 = Color3.new(0, 0, 0) | |
1038 | changeLog.BorderSizePixel = 0 | |
1039 | changeLog.BackgroundTransparency = 0.5 | |
1040 | changeLog.Position = UDim2.new(0.5, -changeLog.Size.X.Offset/2, 0.5, -changeLog.Size.Y.Offset/2) | |
1041 | changeLog.TextColor3 = Color3.new(1, 1, 1) | |
1042 | changeLog.TextXAlignment = "Left" | |
1043 | changeLog.TextYAlignment = "Top" | |
1044 | ||
1045 | local coolButton = Instance.new("TextButton", changeLog) | |
1046 | coolButton.Position = UDim2.new(1, -17, 0, 1) | |
1047 | coolButton.Size = UDim2.new(0, 16, 0, 12) | |
1048 | coolButton.Text = "X" | |
1049 | coolButton.Font = "SourceSans" | |
1050 | coolButton.FontSize = Enum.FontSize.Size12 | |
1051 | coolButton.BorderSizePixel = 0 | |
1052 | coolButton.BackgroundColor3 = Color3.new(1, 0, 0) | |
1053 | coolButton.BackgroundTransparency = 0.2 | |
1054 | coolButton.TextColor3 = Color3.new(1, 1, 1) | |
1055 | coolButton.TextStrokeTransparency = 0.5 | |
1056 | coolButton.ZIndex = 2 | |
1057 | ||
1058 | local line = makeSquare(UDim2.new(0, 0, 1, -14), UDim2.new(1, 0, 0, 14), | |
1059 | Color3.new(0, 0, 0), 0.75, changeLog, 2) | |
1060 | ||
1061 | local line2 = makeSquare(UDim2.new(0, 0, 0, 0), UDim2.new(1, 0, 0, 14), | |
1062 | Color3.new(1, 1, 1), 0.9, changeLog, 1) | |
1063 | ||
1064 | line2.Text = "Change Log" | |
1065 | line2.TextColor3 = Color3.new(1, 1, 1) | |
1066 | line2.TextStrokeTransparency = 0.75 | |
1067 | line2.Font = "SourceSans" | |
1068 | line2.FontSize = Enum.FontSize.Size12 | |
1069 | ||
1070 | line.Text = "Made by Depr1" | |
1071 | line.TextColor3 = Color3.new(1, 0.65, 0) | |
1072 | line.TextStrokeTransparency = 0.5 | |
1073 | line.Font = "SourceSans" | |
1074 | line.FontSize = Enum.FontSize.Size14 | |
1075 | line.TextXAlignment = "Left" | |
1076 | ||
1077 | coolButton.MouseButton1Click:connect(function() | |
1078 | changeLog.Visible = false | |
1079 | end) | |
1080 | ||
1081 | makeSquare(UDim2.new(0, -2, 0, 2), UDim2.new(0, 340, 0, 404), | |
1082 | Color3.new(198/255, 198/255, 198/255), 0, creativeInv, 3) | |
1083 | makeSquare(UDim2.new(0, 338, 0, 0), UDim2.new(0, 6, 0, 406), | |
1084 | Color3.new(85/255, 85/255, 85/255), 0, creativeInv, 2) | |
1085 | makeSquare(UDim2.new(0, 0, 0, 404), UDim2.new(0, 342, 0, 4), | |
1086 | Color3.new(85/255, 85/255, 85/255), 0, creativeInv, 3) | |
1087 | makeSquare(UDim2.new(0, 2, 0, 0), UDim2.new(0, 338, 0, 402), | |
1088 | Color3.new(198/255, 198/255, 198/255), 0, creativeInv, 3) | |
1089 | makeSquare(UDim2.new(0, -4, 0, -2), UDim2.new(0, 4, 0, 406), | |
1090 | Color3.new(255/255, 255/255, 255/255), 0, creativeInv, 3) | |
1091 | makeSquare(UDim2.new(0, -2, 0, -4), UDim2.new(0, 342, 0, 6), | |
1092 | Color3.new(255/255, 255/255, 255/255), 0, creativeInv, 2) | |
1093 | makeSquare(UDim2.new(0, 340, 0, -2), UDim2.new(0, 2, 0, 2), | |
1094 | Color3.new(198/255, 198/255, 198/255), 0, creativeInv, 2) | |
1095 | makeSquare(UDim2.new(0, 340, 0, -4), UDim2.new(0, 2, 0, 4), | |
1096 | Color3.new(0/255, 0/255, 0/255), 0, creativeInv, 1) | |
1097 | makeSquare(UDim2.new(0, 342, 0, -2), UDim2.new(0, 2, 0, 2), | |
1098 | Color3.new(0/255, 0/255, 0/255), 0, creativeInv, 1) | |
1099 | makeSquare(UDim2.new(0, 344, 0, 0), UDim2.new(0, 2, 0, 406), | |
1100 | Color3.new(0/255, 0/255, 0/255), 0, creativeInv, 1) | |
1101 | makeSquare(UDim2.new(0, -4, 0, -4), UDim2.new(0, 2, 0, 4), | |
1102 | Color3.new(0/255, 0/255, 0/255), 0, creativeInv, 1) | |
1103 | makeSquare(UDim2.new(0, -2, 0, -6), UDim2.new(0, 342, 0, 4), | |
1104 | Color3.new(0/255, 0/255, 0/255), 0, creativeInv, 1) | |
1105 | makeSquare(UDim2.new(0, 0, 0, 406), UDim2.new(0, 342, 0, 4), | |
1106 | Color3.new(0/255, 0/255, 0/255), 0, creativeInv, 1) | |
1107 | makeSquare(UDim2.new(0, 342, 0, 404), UDim2.new(0, 2, 0, 4), | |
1108 | Color3.new(0/255, 0/255, 0/255), 0, creativeInv, 1) | |
1109 | makeSquare(UDim2.new(0, -4, 0, 404), UDim2.new(0, 2, 0, 2), | |
1110 | Color3.new(0/255, 0/255, 0/255), 0, creativeInv, 1) | |
1111 | makeSquare(UDim2.new(0, -2, 0, 406), UDim2.new(0, 2, 0, 2), | |
1112 | Color3.new(0/255, 0/255, 0/255), 0, creativeInv, 1) | |
1113 | makeSquare(UDim2.new(0, -6, 0, -2), UDim2.new(0, 2, 0, 406), | |
1114 | Color3.new(0/255, 0/255, 0/255), 0, creativeInv, 1) | |
1115 | local text = makeSquare(UDim2.new(0, 4, 0, 8), UDim2.new(0, 0, 0, 0), Color3.new(0/255, 0/255, 0/255), 1, creativeInv, 3) | |
1116 | text.Text = "Creative Inventory" | |
1117 | text.Font = "SourceSansSemibold" | |
1118 | text.TextSize = 14 | |
1119 | text.TextXAlignment = "Left" | |
1120 | -- | |
1121 | local draggingBlockPicture = Instance.new("ImageLabel", invGui) | |
1122 | draggingBlockPicture.BackgroundTransparency = 1 | |
1123 | draggingBlockPicture.Size = UDim2.new(0, 32, 0, 32) | |
1124 | draggingBlockPicture.ZIndex = 5 | |
1125 | coroutine.resume(coroutine.create(function() | |
1126 | local invMouse = player:GetMouse() | |
1127 | --local RS = game:GetService("RunService").RenderStepped | |
1128 | invMouse.Button2Down:connect(function() | |
1129 | draggingBlock = nil | |
1130 | end) | |
1131 | while RS:wait() do | |
1132 | draggingBlockPicture.Position = UDim2.new(0, invMouse.X - 16, 0, invMouse.Y - 16) | |
1133 | if draggingBlock ~= nil then | |
1134 | draggingBlockPicture.Image = draggingBlock.frontTex | |
1135 | else | |
1136 | draggingBlockPicture.Image = "" | |
1137 | end | |
1138 | end | |
1139 | end)) | |
1140 | ||
1141 | local done = false | |
1142 | local x = 0 | |
1143 | local y = 0 | |
1144 | ||
1145 | for i,b in pairs(creativeInventory) do | |
1146 | local display = "" | |
1147 | if b.displayTex == "" then | |
1148 | display = b.frontTex | |
1149 | else | |
1150 | if b.displayTex then | |
1151 | display = b.displayTex | |
1152 | end | |
1153 | end | |
1154 | putInventorySlot(UDim2.new(0.5, (x*36) + 8, 0.5, (y*36) + 28), display, creativeInv, 4).MouseButton1Down:connect(function() | |
1155 | if draggingBlock == nil then | |
1156 | draggingBlock = b | |
1157 | end | |
1158 | end) | |
1159 | x = x + 1 | |
1160 | if x >= 8 then | |
1161 | x = 0 | |
1162 | y = y + 1 | |
1163 | end | |
1164 | end | |
1165 | if x == 0 then done = true end | |
1166 | while x < 8 and done == false do | |
1167 | putInventorySlot(UDim2.new(0.5, (x*36) + 8, 0.5, (y*36) + 28), "", creativeInv, 4) | |
1168 | x = x + 1 | |
1169 | end | |
1170 | for i = 1, 9 do | |
1171 | if toolBar[i] ~= nil then | |
1172 | local invSlot = putInventorySlot(UDim2.new(0, 8 + ((i-1)*36), 0, 360), toolBar[i].frontTex, creativeInv, 4) | |
1173 | invSlot.MouseButton2Down:connect(function() | |
1174 | local imgLabel = invSlot:FindFirstChild("ImageLabel") | |
1175 | if imgLabel then | |
1176 | toolBar[i] = nil | |
1177 | imgLabel.Image = "" | |
1178 | end | |
1179 | end) | |
1180 | invSlot.MouseButton1Down:connect(function() | |
1181 | --updateHand = true | |
1182 | local imgLabel = invSlot:FindFirstChild("ImageLabel") | |
1183 | if toolBar[i] == nil then | |
1184 | toolBar[i] = draggingBlock | |
1185 | imgLabel.Image = draggingBlock.frontTex | |
1186 | draggingBlock = nil | |
1187 | return | |
1188 | end | |
1189 | if toolBar[i] ~= nil and draggingBlock == nil then | |
1190 | draggingBlock = toolBar[i] | |
1191 | toolBar[i] = nil | |
1192 | imgLabel.Image = "" | |
1193 | return | |
1194 | elseif toolBar[i] ~= nil and draggingBlock ~= nil then | |
1195 | --draggingBlock = toolBar[i] | |
1196 | --toolBar[i] = nil | |
1197 | imgLabel.Image = "" | |
1198 | local temp = toolBar[i] | |
1199 | toolBar[i] = draggingBlock | |
1200 | if imgLabel and draggingBlock ~= nil then | |
1201 | imgLabel.Image = draggingBlock.frontTex | |
1202 | end | |
1203 | if imgLabel and draggingBlock == nil then | |
1204 | imgLabel.Image = "" | |
1205 | end | |
1206 | draggingBlock = temp | |
1207 | return | |
1208 | end | |
1209 | end) | |
1210 | else | |
1211 | local invSlot = putInventorySlot(UDim2.new(0, 8 + ((i-1)*36), 0, 360), "", creativeInv, 4) | |
1212 | invSlot.MouseButton2Down:connect(function() | |
1213 | local imgLabel = invSlot:FindFirstChild("ImageLabel") | |
1214 | if imgLabel then | |
1215 | toolBar[i] = nil | |
1216 | imgLabel.Image = "" | |
1217 | end | |
1218 | end) | |
1219 | invSlot.MouseButton1Down:connect(function() | |
1220 | --updateHand = true | |
1221 | local imgLabel = invSlot:FindFirstChild("ImageLabel") | |
1222 | if toolBar[i] == nil then | |
1223 | toolBar[i] = draggingBlock | |
1224 | imgLabel.Image = draggingBlock.frontTex | |
1225 | draggingBlock = nil | |
1226 | return | |
1227 | end | |
1228 | if toolBar[i] ~= nil and draggingBlock == nil then | |
1229 | draggingBlock = toolBar[i] | |
1230 | toolBar[i] = nil | |
1231 | imgLabel.Image = "" | |
1232 | return | |
1233 | elseif toolBar[i] ~= nil and draggingBlock ~= nil then | |
1234 | --draggingBlock = toolBar[i] | |
1235 | --toolBar[i] = nil | |
1236 | imgLabel.Image = "" | |
1237 | local temp = toolBar[i] | |
1238 | toolBar[i] = draggingBlock | |
1239 | if imgLabel and draggingBlock ~= nil then | |
1240 | imgLabel.Image = draggingBlock.frontTex | |
1241 | end | |
1242 | if imgLabel and draggingBlock == nil then | |
1243 | imgLabel.Image = "" | |
1244 | end | |
1245 | draggingBlock = temp | |
1246 | return | |
1247 | end | |
1248 | end) | |
1249 | end | |
1250 | end | |
1251 | return creativeInv | |
1252 | end | |
1253 | end | |
1254 | function putToolBarSlot(position, image, zindex) | |
1255 | local playerGui = player:FindFirstChild("PlayerGui") | |
1256 | if playerGui then | |
1257 | local gui = playerGui:FindFirstChild("ToolBar") or Instance.new("ScreenGui", playerGui) | |
1258 | gui.Name = "ToolBar" | |
1259 | local slot = Instance.new("ImageLabel", gui) | |
1260 | slot.Position = position | |
1261 | slot.Size = UDim2.new(0, 32, 0, 32) | |
1262 | slot.BackgroundTransparency = 1 | |
1263 | slot.ImageTransparency = 0 | |
1264 | slot.Image = image | |
1265 | slot.ZIndex = 2 | |
1266 | ||
1267 | local imgSlot = makeImage(UDim2.new(0, 0, 0, 0), UDim2.new(0, 32, 0, 32), | |
1268 | "rbxassetid://347007448", slot) | |
1269 | ||
1270 | imgSlot.ImageTransparency = 0.25 | |
1271 | imgSlot.BackgroundTransparency = 1 | |
1272 | imgSlot.ImageColor3 = Color3.new(0.225, 0.225, 0.225) | |
1273 | ||
1274 | makeSquare(UDim2.new(0, 0, 0, 0), UDim2.new(0, 2, 0, 32), | |
1275 | Color3.new(0/255, 0/255, 0/255), 0.7, slot) | |
1276 | makeSquare(UDim2.new(0, 2, 0, 0), UDim2.new(0, 30, 0, 2), | |
1277 | Color3.new(0/255, 0/255, 0/255), 0.7, slot) | |
1278 | makeSquare(UDim2.new(0, -2, 0, -2), UDim2.new(0, 36, 0, 2), | |
1279 | Color3.new(106/255, 106/255, 106/255), 0, slot) | |
1280 | makeSquare(UDim2.new(0, -2, 0, -2), UDim2.new(0, 2, 0, 36), | |
1281 | Color3.new(106/255, 106/255, 106/255), 0, slot) | |
1282 | makeSquare(UDim2.new(0, 0, 0, 32), UDim2.new(0, 34, 0, 2), | |
1283 | Color3.new(130/255, 130/255, 130/255), 0, slot) | |
1284 | makeSquare(UDim2.new(0, 32, 0, 0), UDim2.new(0, 2, 0, 34), | |
1285 | Color3.new(130/255, 130/255, 130/255), 0, slot) | |
1286 | makeSquare(UDim2.new(0, -4, 0, -2), UDim2.new(0, 2, 0, 38), | |
1287 | Color3.new(130/255, 130/255, 130/255), 0, slot) | |
1288 | makeSquare(UDim2.new(0, 34, 0, -2), UDim2.new(0, 2, 0, 36), | |
1289 | Color3.new(106/255, 106/255, 106/255), 0, slot) | |
1290 | makeSquare(UDim2.new(0, -2, 0, 34), UDim2.new(0, 38, 0, 2), | |
1291 | Color3.new(106/255, 106/255, 106/255), 0, slot) | |
1292 | makeSquare(UDim2.new(0, -4, 0, -4), UDim2.new(0, 40, 0, 2), | |
1293 | Color3.new(156/255, 156/255, 156/255), 0, slot) | |
1294 | return slot | |
1295 | end | |
1296 | end | |
1297 | function divide(x, d) | |
1298 | if x ~= 0 and d ~= 0 then | |
1299 | return x/d | |
1300 | else | |
1301 | return x | |
1302 | end | |
1303 | end -- so it doesn't divide by zero | |
1304 | function getDistance(v1, v2) | |
1305 | return math.abs((Vector3.new(math.abs(v2.X - v1.X), math.abs(v2.Y - v1.Y), math.abs(v2.Z - v1.Z))).Magnitude) | |
1306 | end | |
1307 | function SnapToGrid(x, gridX) | |
1308 | local x = math.floor((x / gridX) + 0.5) * gridX | |
1309 | return x | |
1310 | end | |
1311 | function round(x) | |
1312 | if x%2 ~= 0.5 then | |
1313 | return math.floor(x+0.5) | |
1314 | end | |
1315 | return x-0.5 | |
1316 | end | |
1317 | function weldTo(part1, part2) | |
1318 | local weld = Instance.new("Weld", part1) | |
1319 | weld.Part0 = part1 | |
1320 | weld.Part1 = part2 | |
1321 | return weld | |
1322 | end | |
1323 | function getMagnitudeXZ(velocity) | |
1324 | return math.sqrt(math.abs(velocity.X)^2 + math.abs(velocity.Z)^2) | |
1325 | end | |
1326 | function findHumanoid(inst) | |
1327 | local find = inst | |
1328 | local hum = nil | |
1329 | repeat | |
1330 | if find.Name == "Workspace" then return nil end | |
1331 | find = find.Parent | |
1332 | hum = find:FindFirstChild("Humanoid") | |
1333 | until hum | |
1334 | --if hum then print("found!!") else print("aw... not found") end | |
1335 | --if hum.ClassName ~= "Humanoid" then hum = nil end | |
1336 | return hum | |
1337 | end | |
1338 | function getSideByLocation(loc) | |
1339 | local side = nil | |
1340 | if loc.X < 0 then side = "Left" end | |
1341 | if loc.X > 0 then side = "Right" end | |
1342 | if loc.Y > 0 then side = "Top" end | |
1343 | if loc.Y < 0 then side = "Bottom" end | |
1344 | if loc.Z < 0 then side = "Front" end | |
1345 | if loc.Z > 0 then side = "Back" end | |
1346 | ||
1347 | if (math.abs(loc.X) > 0 and math.abs(loc.Y) > 0) or | |
1348 | (math.abs(loc.X) > 0 and math.abs(loc.Z) > 0) or | |
1349 | (math.abs(loc.Y) > 0 and math.abs(loc.Z) > 0) | |
1350 | then | |
1351 | return nil | |
1352 | end | |
1353 | return side | |
1354 | end | |
1355 | function getSideByLocationRedstone(loc) | |
1356 | local side = nil | |
1357 | if loc.X < 0 then side = "Left" end | |
1358 | if loc.X > 0 then side = "Right" end | |
1359 | if loc.Y > 0 then side = "Top" end | |
1360 | if loc.Y < 0 then side = "Bottom" end | |
1361 | if loc.Z < 0 then side = "Front" end | |
1362 | if loc.Z > 0 then side = "Back" end | |
1363 | ||
1364 | if (math.abs(loc.X) > 0 and math.abs(loc.Y) > 0) or | |
1365 | (math.abs(loc.X) > 0 and math.abs(loc.Z) > 0) or | |
1366 | (math.abs(loc.Y) > 0 and math.abs(loc.Z) > 0) | |
1367 | then | |
1368 | return nil | |
1369 | end | |
1370 | return side | |
1371 | end | |
1372 | function getBlockAtRegion(region) | |
1373 | local blockFound = nil | |
1374 | for _,part in pairs(game.Workspace:FindPartsInRegion3(region, nil, math.huge)) do | |
1375 | local usePart = true | |
1376 | if part.Name == "Debris" then usePart = false end | |
1377 | if usePart == true then | |
1378 | blockFound = part | |
1379 | break | |
1380 | end | |
1381 | end | |
1382 | return blockFound | |
1383 | end | |
1384 | function getRedstoneAtRegion(region) | |
1385 | local blockFound = nil | |
1386 | for _,part in pairs(game.Workspace:FindPartsInRegion3(region, nil, math.huge)) do | |
1387 | if isRedstone(part) then | |
1388 | blockFound = part | |
1389 | break | |
1390 | end | |
1391 | end | |
1392 | return blockFound | |
1393 | end | |
1394 | function isRedstone(block) | |
1395 | local objType = block:FindFirstChild("ObjectType") | |
1396 | if objType then | |
1397 | if objType.Value == "Redstone Dust" then | |
1398 | return true | |
1399 | else | |
1400 | return false | |
1401 | end | |
1402 | end | |
1403 | end | |
1404 | function updateRedstoneDust(dust, leftBlk, rightBlk, topBlk, bottomBlk, frontBlk, backBlk, recursion) | |
1405 | local objType = nil | |
1406 | if dust then | |
1407 | objType = dust:FindFirstChild("ObjectType") | |
1408 | end | |
1409 | ||
1410 | local redstoneDust = "rbxassetid://151911305" | |
1411 | local redstoneLine = "rbxassetid://151907047" | |
1412 | local redstoneCorner = "rbxassetid://151907106" | |
1413 | local redstoneT = "rbxassetid://151907156" | |
1414 | local redstoneCross = "rbxassetid://151906997" | |
1415 | ||
1416 | local Rotation = 0 | |
1417 | ||
1418 | local theresRedstoneAtLeft = false | |
1419 | local theresRedstoneAtRight = false | |
1420 | local theresRedstoneAtFront = false | |
1421 | local theresRedstoneAtBack = false | |
1422 | ||
1423 | if leftBlk then theresRedstoneAtLeft = isRedstone(leftBlk) end | |
1424 | if rightBlk then theresRedstoneAtRight = isRedstone(rightBlk) end | |
1425 | if frontBlk then theresRedstoneAtFront = isRedstone(frontBlk) end | |
1426 | if backBlk then theresRedstoneAtBack = isRedstone(backBlk) end | |
1427 | ||
1428 | if objType then | |
1429 | if objType.Value == "Redstone Dust" then | |
1430 | local topDecal = dust:FindFirstChild("Top") | |
1431 | if topDecal then | |
1432 | if theresRedstoneAtBack == false and theresRedstoneAtFront == false and | |
1433 | theresRedstoneAtLeft == false and theresRedstoneAtRight == false then | |
1434 | topDecal.Texture = redstoneDust | |
1435 | Rotation = 0 | |
1436 | end | |
1437 | ||
1438 | if theresRedstoneAtLeft == true or theresRedstoneAtRight == true then | |
1439 | topDecal.Texture = redstoneLine | |
1440 | Rotation = 0 | |
1441 | end | |
1442 | ||
1443 | if theresRedstoneAtFront == true or theresRedstoneAtBack == true then | |
1444 | topDecal.Texture = redstoneLine | |
1445 | Rotation = 90 | |
1446 | end | |
1447 | ||
1448 | if theresRedstoneAtLeft == true and theresRedstoneAtBack == true then | |
1449 | topDecal.Texture = redstoneCorner | |
1450 | Rotation = 0 | |
1451 | end | |
1452 | ||
1453 | if theresRedstoneAtBack == true and theresRedstoneAtRight == true then | |
1454 | topDecal.Texture = redstoneCorner | |
1455 | Rotation = 90 | |
1456 | end | |
1457 | ||
1458 | if theresRedstoneAtRight == true and theresRedstoneAtFront == true then | |
1459 | topDecal.Texture = redstoneCorner | |
1460 | Rotation = 180 | |
1461 | end | |
1462 | ||
1463 | if theresRedstoneAtFront == true and theresRedstoneAtLeft == true then | |
1464 | topDecal.Texture = redstoneCorner | |
1465 | Rotation = -90 | |
1466 | end | |
1467 | ||
1468 | if theresRedstoneAtBack == true and theresRedstoneAtLeft == true | |
1469 | and theresRedstoneAtFront == true then | |
1470 | topDecal.Texture = redstoneT | |
1471 | Rotation = -90 | |
1472 | end | |
1473 | ||
1474 | if theresRedstoneAtLeft == true and theresRedstoneAtFront == true | |
1475 | and theresRedstoneAtRight == true then | |
1476 | topDecal.Texture = redstoneT | |
1477 | Rotation = -180 | |
1478 | end | |
1479 | ||
1480 | if theresRedstoneAtFront == true and theresRedstoneAtRight == true | |
1481 | and theresRedstoneAtBack == true then | |
1482 | topDecal.Texture = redstoneT | |
1483 | Rotation = 90 | |
1484 | end | |
1485 | ||
1486 | if theresRedstoneAtRight == true and theresRedstoneAtBack == true | |
1487 | and theresRedstoneAtLeft == true then | |
1488 | topDecal.Texture = redstoneT | |
1489 | Rotation = 0 | |
1490 | end | |
1491 | ||
1492 | if theresRedstoneAtLeft == true and theresRedstoneAtRight == true and | |
1493 | theresRedstoneAtFront == true and theresRedstoneAtBack == true then | |
1494 | topDecal.Texture = redstoneCross | |
1495 | Rotation = 0 | |
1496 | end | |
1497 | end | |
1498 | else | |
1499 | error("Not redstone dust.") | |
1500 | end | |
1501 | end | |
1502 | ||
1503 | if recursion == true then | |
1504 | local function updateTex(blockTarget) | |
1505 | local leftSide = nil | |
1506 | local rightSide = nil | |
1507 | local frontSide = nil | |
1508 | local backSide = nil | |
1509 | ||
1510 | local Point1 = blockTarget.CFrame.p - Vector3.new(2.6, 0.1, 2.6) | |
1511 | local Point2 = blockTarget.CFrame.p + Vector3.new(2.6, 0.1, 2.6) | |
1512 | local Region = Region3.new(Point1, Point2) | |
1513 | for _,part in pairs(game.Workspace:FindPartsInRegion3( | |
1514 | Region, | |
1515 | nil, | |
1516 | math.huge | |
1517 | )) do | |
1518 | local objType = part:FindFirstChild("ObjectType") | |
1519 | if isRedstone(part) then | |
1520 | local side = getSideByLocationRedstone(blockTarget.CFrame.p - part.CFrame.p) | |
1521 | if side == "Left" then | |
1522 | leftSide = part | |
1523 | elseif side == "Right" then | |
1524 | rightSide = part | |
1525 | elseif side == "Front" then | |
1526 | frontSide = part | |
1527 | elseif side == "Back" then | |
1528 | backSide = part | |
1529 | elseif side == "Left Top" then | |
1530 | leftSide = part | |
1531 | elseif side == "Right Top" then | |
1532 | rightSide = part | |
1533 | elseif side == "Front Top" then | |
1534 | frontSide = part | |
1535 | elseif side == "Back Top" then | |
1536 | backSide = part | |
1537 | elseif side == "Left Bottom" then | |
1538 | leftSide = part | |
1539 | elseif side == "Right Bottom" then | |
1540 | rightSide = part | |
1541 | elseif side == "Front Bottom" then | |
1542 | frontSide = part | |
1543 | elseif side == "Back Bottom" then | |
1544 | backSide = part | |
1545 | end | |
1546 | end | |
1547 | end | |
1548 | ||
1549 | updateRedstoneDust(blockTarget, leftSide, rightSide, nil, nil, frontSide, backSide, false) | |
1550 | end | |
1551 | if leftBlk and theresRedstoneAtLeft then updateTex(leftBlk) end | |
1552 | if rightBlk and theresRedstoneAtRight then updateTex(rightBlk) end | |
1553 | if frontBlk and theresRedstoneAtFront then updateTex(frontBlk) end | |
1554 | if backBlk and theresRedstoneAtBack then updateTex(backBlk) end | |
1555 | end | |
1556 | ||
1557 | if dust then dust.CFrame = CFrame.new(dust.CFrame.p.X, dust.CFrame.p.Y, dust.CFrame.p.Z) * CFrame.Angles(0, math.rad(Rotation), 0) end | |
1558 | end | |
1559 | function placeBlock(block, cFPos, Mouse) | |
1560 | if block == nil then | |
1561 | if Mouse.Target.Size.X <= 10 and Mouse.Target.Size.Y <= 10 and Mouse.Target.Size.Z <= 10 and Mouse.Target then | |
1562 | if Mouse.Target.Parent.Name ~= "Camera" then | |
1563 | --print(Mouse.Target:GetFullName()) | |
1564 | local blkTar = Mouse.Target | |
1565 | --Mouse.Target.Parent = nil | |
1566 | local blockIsRedstone = isRedstone(blkTar) | |
1567 | ||
1568 | local Point1 = blkTar.CFrame.p - Vector3.new(2.7, 2.7, 2.7) | |
1569 | local Point2 = blkTar.CFrame.p + Vector3.new(2.7, 2.7, 2.7) | |
1570 | local Region = Region3.new(Point1, Point2) | |
1571 | for _,part in pairs(game.Workspace:FindPartsInRegion3( | |
1572 | Region, | |
1573 | nil, | |
1574 | math.huge | |
1575 | )) do | |
1576 | ||
1577 | if part:FindFirstChild("IsBlock") then | |
1578 | local side1 = getSideByLocation(blkTar.CFrame.p - part.CFrame.p) | |
1579 | if getSideByLocation(blkTar.CFrame.p - part.CFrame.p) then | |
1580 | local texture = part:FindFirstChild(side1) | |
1581 | if texture then | |
1582 | texture.Transparency = 0 | |
1583 | end | |
1584 | end | |
1585 | end | |
1586 | end | |
1587 | ||
1588 | for i = 1, 9 do | |
1589 | local part = Instance.new("Part", workspace) | |
1590 | part.Size = Vector3.new(0, 0, 0) | |
1591 | part.Transparency = 1 | |
1592 | part.CanCollide = false | |
1593 | part.Velocity = Vector3.new(math.random(-5, 5), 5, math.random(-5, 5)) | |
1594 | part.Name = "Debris" | |
1595 | ||
1596 | part.CFrame = | |
1597 | Mouse.Target.CFrame * | |
1598 | CFrame.new(math.random(-blkTar.Size.X/2, blkTar.Size.X/2), math.random(-blkTar.Size.Y/2, blkTar.Size.Y/2), math.random(-blkTar.Size.Z/2, blkTar.Size.Z/2)) | |
1599 | ||
1600 | part.CustomPhysicalProperties = PhysicalProperties.new(0, 0.2, 0, 100, 100) | |
1601 | ||
1602 | local billboard = Instance.new("BillboardGui", part) | |
1603 | billboard.Size = UDim2.new(1.2, 0, 1.2, 0) | |
1604 | ||
1605 | local clipDescendant = Instance.new("TextLabel", billboard) | |
1606 | clipDescendant.Size = UDim2.new(0.5, 0, 0.5, 0) | |
1607 | clipDescendant.BackgroundTransparency = 1 | |
1608 | clipDescendant.Text = "" | |
1609 | clipDescendant.ClipsDescendants = true | |
1610 | ||
1611 | local img = Instance.new("ImageLabel", clipDescendant) | |
1612 | img.Size = UDim2.new(2, 0, 2, 0) | |
1613 | img.BackgroundTransparency = 1 | |
1614 | img.Position = UDim2.new(math.random(-70, 70)/100, 0, math.random(-70, 70)/100, 0) | |
1615 | ||
1616 | local tex = blkTar:FindFirstChild("Front") | |
1617 | if tex then | |
1618 | img.Image = tex.Texture | |
1619 | else | |
1620 | img.Image = "rbxassetid://744949545" | |
1621 | end | |
1622 | ||
1623 | if img.Image == "rbxassetid://744949545" then | |
1624 | img.ImageColor3 = blkTar.Color | |
1625 | end | |
1626 | ||
1627 | part.Touched:connect(function(prt) | |
1628 | if prt ~= blkTar then | |
1629 | part.CanCollide = true | |
1630 | end | |
1631 | end) | |
1632 | ||
1633 | coroutine.resume(coroutine.create(function() | |
1634 | wait(math.random(50, 65)/100) | |
1635 | part:Destroy() | |
1636 | end)) | |
1637 | --part.Anchored = false | |
1638 | end | |
1639 | blkTar:Destroy() | |
1640 | if blockIsRedstone == true then | |
1641 | local leftSide = nil | |
1642 | local rightSide = nil | |
1643 | local frontSide = nil | |
1644 | local backSide = nil | |
1645 | ||
1646 | local Point1 = blkTar.CFrame.p - Vector3.new(2.6, 0.1, 2.6) | |
1647 | local Point2 = blkTar.CFrame.p + Vector3.new(2.6, 0.1, 2.6) | |
1648 | local Region = Region3.new(Point1, Point2) | |
1649 | for _,part in pairs(game.Workspace:FindPartsInRegion3( | |
1650 | Region, | |
1651 | nil, | |
1652 | math.huge | |
1653 | )) do | |
1654 | local objType = part:FindFirstChild("ObjectType") | |
1655 | if isRedstone(part) then | |
1656 | local side = getSideByLocationRedstone(blkTar.CFrame.p - part.CFrame.p) | |
1657 | if side == "Left" then | |
1658 | leftSide = part | |
1659 | elseif side == "Right" then | |
1660 | rightSide = part | |
1661 | elseif side == "Front" then | |
1662 | frontSide = part | |
1663 | elseif side == "Back" then | |
1664 | backSide = part | |
1665 | elseif side == "Left Top" then | |
1666 | leftSide = part | |
1667 | elseif side == "Right Top" then | |
1668 | rightSide = part | |
1669 | elseif side == "Front Top" then | |
1670 | frontSide = part | |
1671 | elseif side == "Back Top" then | |
1672 | backSide = part | |
1673 | elseif side == "Left Bottom" then | |
1674 | leftSide = part | |
1675 | elseif side == "Right Bottom" then | |
1676 | rightSide = part | |
1677 | elseif side == "Front Bottom" then | |
1678 | frontSide = part | |
1679 | elseif side == "Back Bottom" then | |
1680 | backSide = part | |
1681 | end | |
1682 | end | |
1683 | end | |
1684 | ||
1685 | updateRedstoneDust(nil, leftSide, rightSide, nil, nil, frontSide, backSide, true) | |
1686 | end | |
1687 | end | |
1688 | end | |
1689 | return nil | |
1690 | else | |
1691 | local blkMouseTarget = Mouse.Target | |
1692 | ||
1693 | local blockPlaced = Instance.new("Part", workspace) | |
1694 | blockPlaced.Material = "Fabric" | |
1695 | blockPlaced.Transparency = block.transparency | |
1696 | blockPlaced.Anchored = true | |
1697 | blockPlaced.Size = block.size | |
1698 | ||
1699 | blockPlaced.CFrame = cFPos | |
1700 | ||
1701 | local blockType = Instance.new("StringValue", blockPlaced) | |
1702 | blockType.Name = "ObjectType" | |
1703 | blockType.Value = block.objectType | |
1704 | ||
1705 | blockPlaced.Name = block.name | |
1706 | putTexture(blockPlaced, block.frontTex, block.backTex, | |
1707 | block.topTex, block.bottomTex, block.leftTex, block.rightTex, "Texture") | |
1708 | ||
1709 | if block.objectType == "Slab" then | |
1710 | blockPlaced.Size = blockPlaced.Size / Vector3.new(1, 2, 1) | |
1711 | blockPlaced.CFrame = blockPlaced.CFrame * CFrame.new(0, -blockPlaced.Size.Y/2, 0) | |
1712 | elseif block.objectType == "Redstone Dust" then | |
1713 | blockPlaced.CFrame = blockPlaced.CFrame * CFrame.new(0, -1.3, 0) | |
1714 | blockPlaced.CanCollide = false | |
1715 | ||
1716 | local canPlace = false | |
1717 | ||
1718 | if isRedstone(blkMouseTarget) == true then | |
1719 | blockPlaced:Destroy() | |
1720 | return | |
1721 | end | |
1722 | ||
1723 | local partBelow = getBlockAtRegion(Region3.new( | |
1724 | blockPlaced.CFrame.p - Vector3.new(1, 1, 1), | |
1725 | blockPlaced.CFrame.p + Vector3.new(1, 1, 1) | |
1726 | )) | |
1727 | ||
1728 | if partBelow then | |
1729 | local targetObjType = partBelow:FindFirstChild("ObjectType") | |
1730 | if targetObjType then | |
1731 | if targetObjType.Value == "Block" then | |
1732 | canPlace = true | |
1733 | end | |
1734 | end | |
1735 | end | |
1736 | ||
1737 | if canPlace == false then | |
1738 | blockPlaced:Destroy() | |
1739 | return | |
1740 | end | |
1741 | ||
1742 | local leftSide = nil | |
1743 | local rightSide = nil | |
1744 | local frontSide = nil | |
1745 | local backSide = nil | |
1746 | ||
1747 | local Point1 = blockPlaced.CFrame.p - Vector3.new(2.6, 0.1, 2.6) | |
1748 | local Point2 = blockPlaced.CFrame.p + Vector3.new(2.6, 0.1, 2.6) | |
1749 | local Region = Region3.new(Point1, Point2) | |
1750 | for _,part in pairs(game.Workspace:FindPartsInRegion3( | |
1751 | Region, | |
1752 | nil, | |
1753 | math.huge | |
1754 | )) do | |
1755 | local objType = part:FindFirstChild("ObjectType") | |
1756 | if isRedstone(part) then | |
1757 | ||
1758 | local side = getSideByLocationRedstone(blockPlaced.CFrame.p - part.CFrame.p) | |
1759 | if side == "Left" then | |
1760 | leftSide = part | |
1761 | elseif side == "Right" then | |
1762 | rightSide = part | |
1763 | elseif side == "Front" then | |
1764 | frontSide = part | |
1765 | elseif side == "Back" then | |
1766 | backSide = part | |
1767 | elseif side == "Left Top" then | |
1768 | leftSide = part | |
1769 | elseif side == "Right Top" then | |
1770 | rightSide = part | |
1771 | elseif side == "Front Top" then | |
1772 | frontSide = part | |
1773 | elseif side == "Back Top" then | |
1774 | backSide = part | |
1775 | elseif side == "Left Bottom" then | |
1776 | leftSide = part | |
1777 | elseif side == "Right Bottom" then | |
1778 | rightSide = part | |
1779 | elseif side == "Front Bottom" then | |
1780 | frontSide = part | |
1781 | elseif side == "Back Bottom" then | |
1782 | backSide = part | |
1783 | end | |
1784 | ||
1785 | ||
1786 | --if getSideByLocation(cFPos.p - part.CFrame.p) then | |
1787 | -- local texture = part:FindFirstChild(side1) | |
1788 | -- if texture then | |
1789 | -- texture.Transparency = 1 | |
1790 | -- end | |
1791 | --end | |
1792 | --[[local side2 = getSideByLocation(part.CFrame.p - cFPos.p) | |
1793 | if getSideByLocation(cFPos.p - part.CFrame.p) then | |
1794 | local texture = blockPlaced:FindFirstChild(side2) | |
1795 | if texture then | |
1796 | texture.Transparency = 1 | |
1797 | end | |
1798 | end]] | |
1799 | end | |
1800 | end | |
1801 | ||
1802 | updateRedstoneDust(blockPlaced, leftSide, rightSide, nil, nil, frontSide, backSide, true) | |
1803 | ||
1804 | --local partBelow = getBlockAtRegion(Region3.new( | |
1805 | -- blockPlaced.CFrame.p - Vector3.new(1, 1, 1), | |
1806 | -- blockPlaced.CFrame.p + Vector3.new(1, 1, 1) | |
1807 | --)) | |
1808 | end | |
1809 | ||
1810 | if Mouse.Target.Name == block.name then | |
1811 | local targetObjType = Mouse.Target:FindFirstChild("ObjectType") | |
1812 | if targetObjType then | |
1813 | if targetObjType.Value == "Slab" then | |
1814 | local side = Mouse.TargetSurface.Name --getSideByLocation(Mouse.Target.Position - cFPos.p) | |
1815 | if side == "Bottom" or side == "Top" then | |
1816 | Mouse.Target.Size = Mouse.Target.Size * Vector3.new(1, 2, 1) | |
1817 | Mouse.Target.CFrame = Mouse.Target.CFrame * CFrame.new(0, blockPlaced.Size.Y/2, 0) | |
1818 | ||
1819 | targetObjType.Value = "Block" | |
1820 | ||
1821 | blockPlaced:Destroy() | |
1822 | return | |
1823 | end | |
1824 | end | |
1825 | end | |
1826 | end | |
1827 | ||
1828 | local Point1 = cFPos.p - Vector3.new(2.7, 2.7, 2.7) | |
1829 | local Point2 = cFPos.p + Vector3.new(2.7, 2.7, 2.7) | |
1830 | local Region = Region3.new(Point1, Point2) | |
1831 | for _,part in pairs(game.Workspace:FindPartsInRegion3( | |
1832 | Region, | |
1833 | nil, | |
1834 | math.huge | |
1835 | )) do | |
1836 | local objType = part:FindFirstChild("ObjectType") | |
1837 | if part:FindFirstChild("IsBlock") and objType then | |
1838 | local doNothing = false | |
1839 | if objType.Value == "Slab" or block.objectType == "Slab" then doNothing = true end | |
1840 | if part.Name == blockPlaced.Name and doNothing == false then | |
1841 | local side1 = getSideByLocation(cFPos.p - part.CFrame.p) | |
1842 | if getSideByLocation(cFPos.p - part.CFrame.p) then | |
1843 | local texture = part:FindFirstChild(side1) | |
1844 | if texture then | |
1845 | texture.Transparency = 1 | |
1846 | end | |
1847 | end | |
1848 | local side2 = getSideByLocation(part.CFrame.p - cFPos.p) | |
1849 | if getSideByLocation(cFPos.p - part.CFrame.p) then | |
1850 | local texture = blockPlaced:FindFirstChild(side2) | |
1851 | if texture then | |
1852 | texture.Transparency = 1 | |
1853 | end | |
1854 | end | |
1855 | end | |
1856 | end | |
1857 | end | |
1858 | ||
1859 | ||
1860 | local isBlock = Instance.new("CFrameValue", blockPlaced) | |
1861 | isBlock.Name = "IsBlock" | |
1862 | ||
1863 | if block.hasGravity == true then | |
1864 | local connectedTo = Instance.new("ObjectValue", blockPlaced) | |
1865 | connectedTo.Name = "ConnectedTo" | |
1866 | blockPlaced.Anchored = false | |
1867 | blockPlaced.CanCollide = false | |
1868 | local detector = Instance.new("Part", workspace:WaitForChild("Camera")) | |
1869 | detector.Transparency = 1 | |
1870 | detector.CanCollide = false | |
1871 | detector.Size = Vector3.new(1, 0, 1) | |
1872 | local weldDetector = Instance.new("Motor6D", detector) | |
1873 | weldDetector.Part0 = detector | |
1874 | weldDetector.Part1 = blockPlaced | |
1875 | weldDetector.C1 = CFrame.new(0, -blockPlaced.Size.Y/2, 0) | |
1876 | local landed = false | |
1877 | local function fallingBlock() | |
1878 | coroutine.resume(coroutine.create(function() | |
1879 | local falling = blockPlaced:FindFirstChild("IsFalling") or Instance.new("CFrameValue", blockPlaced) | |
1880 | falling.Name = "IsFalling" | |
1881 | local grav = 0 | |
1882 | while RS:wait() do | |
1883 | if landed then falling:Destroy() break end | |
1884 | grav = math.max(-1, grav - 0.0025) | |
1885 | --blockPlaced.CFrame = CFrame.new(cFPos.X, blockPlaced.CFrame.Y + grav, cFPos.Z) | |
1886 | end | |
1887 | end)) | |
1888 | end | |
1889 | fallingBlock() | |
1890 | detector.Touched:connect(function(part) | |
1891 | if blockPlaced.Anchored == false and part ~= blockPlaced and part.Name ~= "Debris" and part:FindFirstChild("IsFalling") == nil and findHumanoid(part) == nil then | |
1892 | landed = true | |
1893 | blockPlaced.CanCollide = true | |
1894 | blockPlaced.Velocity = Vector3.new(0, 0, 0) | |
1895 | blockPlaced.Anchored = true | |
1896 | connectedTo.Value = part | |
1897 | local yOrigin = part.CFrame.Y + (blockPlaced.Size.Y/2) + (part.Size.Y/2) | |
1898 | blockPlaced.CFrame = CFrame.new(cFPos.X, yOrigin, cFPos.Z) | |
1899 | --detector:Destroy() | |
1900 | local falling = false | |
1901 | part.Changed:connect(function() | |
1902 | if part.Position.Y ~= yOrigin and falling == false then | |
1903 | falling = true | |
1904 | wait(0.075) | |
1905 | landed = false | |
1906 | blockPlaced.Anchored = false | |
1907 | blockPlaced.CanCollide = false | |
1908 | blockPlaced.Velocity = Vector3.new(0, 0, 0) | |
1909 | fallingBlock() | |
1910 | falling = false | |
1911 | end | |
1912 | end) | |
1913 | workspace.ChildRemoved:connect(function() | |
1914 | --print("hi") | |
1915 | if connectedTo.Value.Parent == nil and falling == false then | |
1916 | falling = true | |
1917 | landed = false | |
1918 | blockPlaced.Anchored = false | |
1919 | blockPlaced.CanCollide = false | |
1920 | blockPlaced.Velocity = Vector3.new(0, 0, 0) | |
1921 | fallingBlock() | |
1922 | end | |
1923 | end) | |
1924 | end | |
1925 | end) | |
1926 | end | |
1927 | ||
1928 | local blockSound = Instance.new("Sound", blockPlaced) | |
1929 | blockSound.SoundId = block.sound | |
1930 | blockSound.Volume = block.soundVol | |
1931 | blockSound.Pitch = math.random(95, 105)/100 | |
1932 | blockSound.PlayOnRemove = true | |
1933 | blockSound:Play() | |
1934 | return blockPlaced | |
1935 | end | |
1936 | end | |
1937 | if player then | |
1938 | local char = player.Character | |
1939 | if char then | |
1940 | for _,cM in pairs(char:GetChildren()) do | |
1941 | if cM.ClassName == "CharacterMesh" then cM:Destroy() end | |
1942 | end | |
1943 | ||
1944 | --[] | |
1945 | local gui = player.PlayerGui:FindFirstChild("ToolBar") or Instance.new("ScreenGui", player.PlayerGui) | |
1946 | gui.Name = "ToolBar" | |
1947 | ||
1948 | makeSquare(UDim2.new(0.5, -166, 1, -111), UDim2.new(0, 364, 0, 2), | |
1949 | Color3.new(0/255, 0/255, 0/255), 0, gui) | |
1950 | makeSquare(UDim2.new(0.5, -166, 1, -111 + 42), UDim2.new(0, 364, 0, 2), | |
1951 | Color3.new(0/255, 0/255, 0/255), 0, gui) | |
1952 | makeSquare(UDim2.new(0.5, -166, 1, -111), UDim2.new(0, 2, 0, 44), | |
1953 | Color3.new(0/255, 0/255, 0/255), 0, gui) | |
1954 | makeSquare(UDim2.new(0.5, -166 + 362, 1, -111), UDim2.new(0, 2, 0, 44), | |
1955 | Color3.new(0/255, 0/255, 0/255), 0, gui) | |
1956 | ||
1957 | for i = 1, 9 do | |
1958 | if toolBar[i] ~= nil then | |
1959 | local img = putToolBarSlot(UDim2.new(0.5, -160 + ((i-1)*40), 1, -105), toolBar[i].frontTex) | |
1960 | coroutine.resume(coroutine.create(function() | |
1961 | while wait() do | |
1962 | if toolBar[i] ~= nil then | |
1963 | if toolBar[i].displayTex == "" then | |
1964 | img.Image = toolBar[i].frontTex | |
1965 | else | |
1966 | img.Image = toolBar[i].displayTex | |
1967 | end | |
1968 | else | |
1969 | img.Image = "" | |
1970 | end | |
1971 | end | |
1972 | end)) | |
1973 | else | |
1974 | local img = putToolBarSlot(UDim2.new(0.5, -160 + ((i-1)*40), 1, -105), "") | |
1975 | coroutine.resume(coroutine.create(function() | |
1976 | while wait() do | |
1977 | if toolBar[i] ~= nil then | |
1978 | if toolBar[i].displayTex == "" then | |
1979 | img.Image = toolBar[i].frontTex | |
1980 | else | |
1981 | img.Image = toolBar[i].displayTex | |
1982 | end | |
1983 | else | |
1984 | img.Image = "" | |
1985 | end | |
1986 | end | |
1987 | end)) | |
1988 | end | |
1989 | end | |
1990 | ||
1991 | local creativeInventoryGUI = makeInventory() | |
1992 | ||
1993 | local humRootPart = char:WaitForChild("HumanoidRootPart") | |
1994 | local head = char:WaitForChild("Head") | |
1995 | local torso = char:WaitForChild("Torso") | |
1996 | local lArm = char:WaitForChild("Left Arm") | |
1997 | local rArm = char:WaitForChild("Right Arm") | |
1998 | local lLeg = char:WaitForChild("Left Leg") | |
1999 | local rLeg = char:WaitForChild("Right Leg") | |
2000 | ||
2001 | local humanoid = char:WaitForChild("Humanoid") | |
2002 | char.Humanoid:ClearAllChildren() | |
2003 | humanoid.HipHeight = 0.3 | |
2004 | humanoid.AutoRotate = false | |
2005 | ||
2006 | -- Heart bar | |
2007 | local hpFrame = makeSquare(UDim2.new(0.5, -166, 1, -130), UDim2.new(0, 162, 0, 18), | |
2008 | Color3.new(0/255, 0/255, 0/255), 1, gui, 1) | |
2009 | ||
2010 | local hearts = makeSquare(UDim2.new(0, 0, 0, 0), UDim2.new(0, 162, 0, 18), | |
2011 | Color3.new(0/255, 0/255, 0/255), 1, hpFrame, 1) | |
2012 | hearts.ClipsDescendants = true | |
2013 | ||
2014 | for i = 1, 10 do | |
2015 | local heartImg = makeImage(UDim2.new(0, (i-1)*16, 0, 0), UDim2.new(0, 18, 0, 18), | |
2016 | "rbxassetid://1494233443", hearts, 2) | |
2017 | ||
2018 | makeSquare(UDim2.new(0, 4, 0, 4), UDim2.new(0, 2, 0, 2), | |
2019 | Color3.new(255/255, 200/255, 200/255), 0, heartImg, 2) | |
2020 | ||
2021 | heartImg.ImageColor3 = Color3.new(240/255, 0, 0) | |
2022 | ||
2023 | local emptyHeart = makeImage(UDim2.new(0, (i-1)*16, 0, 0), UDim2.new(0, 18, 0, 18), | |
2024 | "rbxassetid://1494233443", hpFrame, 1) | |
2025 | emptyHeart.ImageColor3 = Color3.new(0.3, 0.3, 0.3) | |
2026 | ||
2027 | local outline = makeImage(UDim2.new(0, 0, 0, 0), UDim2.new(0, 18, 0, 18), | |
2028 | "rbxassetid://1494176679", emptyHeart, 1) | |
2029 | outline.ImageColor3 = Color3.new(0, 0, 0) | |
2030 | ||
2031 | local oldHP = humanoid.Health/humanoid.MaxHealth --SnapToGrid((humanoid.Health/humanoid.MaxHealth)*162, 8) | |
2032 | humanoid.Changed:connect(function() | |
2033 | local hp = humanoid.Health/humanoid.MaxHealth --SnapToGrid((humanoid.Health/humanoid.MaxHealth)*162, 8) | |
2034 | if SnapToGrid(oldHP*162, 8) < SnapToGrid(hp*162, 8) then | |
2035 | outline.ImageColor3 = Color3.new(1, 1, 1) | |
2036 | wait(0.1) | |
2037 | outline.ImageColor3 = Color3.new(0, 0, 0) | |
2038 | wait(0.1) | |
2039 | end | |
2040 | if oldHP > hp then | |
2041 | for i = 1, 2 do | |
2042 | outline.ImageColor3 = Color3.new(1, 1, 1) | |
2043 | wait(0.1) | |
2044 | outline.ImageColor3 = Color3.new(0, 0, 0) | |
2045 | wait(0.1) | |
2046 | end | |
2047 | end | |
2048 | oldHP = hp | |
2049 | end) | |
2050 | coroutine.resume(coroutine.create(function() | |
2051 | local yIncrease = 0 | |
2052 | local originalY = emptyHeart.Position.Y.Offset | |
2053 | ||
2054 | while wait() do | |
2055 | if humanoid.Health/humanoid.MaxHealth <= 0.27 then | |
2056 | if yIncrease <= 0 then | |
2057 | yIncrease = math.random(1, 2) | |
2058 | else | |
2059 | yIncrease = yIncrease - 1 | |
2060 | end | |
2061 | ||
2062 | heartImg.Position = UDim2.new(0, heartImg.Position.X.Offset, 0, -yIncrease) | |
2063 | emptyHeart.Position = UDim2.new(0, emptyHeart.Position.X.Offset, 0, -yIncrease) | |
2064 | else | |
2065 | if yIncrease >= 1 then | |
2066 | yIncrease = yIncrease - 1 | |
2067 | ||
2068 | heartImg.Position = UDim2.new(0, heartImg.Position.X.Offset, 0, -yIncrease) | |
2069 | emptyHeart.Position = UDim2.new(0, emptyHeart.Position.X.Offset, 0, -yIncrease) | |
2070 | end | |
2071 | end | |
2072 | end | |
2073 | end)) | |
2074 | end | |
2075 | ||
2076 | humanoid.Parent = nil | |
2077 | ||
2078 | if char:FindFirstChild("Animate") then | |
2079 | char.Animate:Remove() | |
2080 | end | |
2081 | ||
2082 | head.Size = Vector3.new(1.3, 1.3, 1.3) | |
2083 | putTexture(head, "rbxassetid://38738031", "rbxassetid://36047330", | |
2084 | "rbxassetid://36047341", "rbxassetid://36047347", | |
2085 | "rbxassetid://36047323", "rbxassetid://36047315", "Decal") | |
2086 | head:WaitForChild("Mesh"):Destroy() | |
2087 | head:WaitForChild("face"):Destroy() | |
2088 | ||
2089 | torso.Size = Vector3.new(1.3, 1.95, 0.65) | |
2090 | putTexture(torso, "rbxassetid://38934753", "rbxassetid://38934731", | |
2091 | "rbxassetid://38934780", "rbxassetid://38934740", | |
2092 | "rbxassetid://38934762", "rbxassetid://38934762", "Decal") | |
2093 | ||
2094 | lArm.Size = Vector3.new(0.65, 1.95, 0.65) | |
2095 | putTexture(lArm, "rbxassetid://38934581", "rbxassetid://38934560", | |
2096 | "rbxassetid://38934613", "rbxassetid://38934568", | |
2097 | "rbxassetid://38934601", "rbxassetid://38934591", "Decal") | |
2098 | ||
2099 | rArm.Size = Vector3.new(0.65, 1.95, 0.65) | |
2100 | putTexture(rArm, "rbxassetid://38934560", "rbxassetid://38934581", | |
2101 | "rbxassetid://38934613", "rbxassetid://38934568", | |
2102 | "rbxassetid://38934601", "rbxassetid://38934591", "Decal") | |
2103 | ||
2104 | lLeg.Size = Vector3.new(0.65, 1.95, 0.65) | |
2105 | putTexture(lLeg, "rbxassetid://38936226", "rbxassetid://38936209", | |
2106 | "rbxassetid://38934719", "rbxassetid://38934712", | |
2107 | "rbxassetid://38936255", "rbxassetid://38936242", "Decal") | |
2108 | ||
2109 | rLeg.Size = Vector3.new(0.65, 1.95, 0.65) | |
2110 | putTexture(rLeg, "rbxassetid://38936209", "rbxassetid://38936226", | |
2111 | "rbxassetid://38934719", "rbxassetid://38934712", | |
2112 | "rbxassetid://38936242", "rbxassetid://38936255", "Decal") | |
2113 | ||
2114 | -- now for the real stuff | |
2115 | -- | | |
2116 | -- | | |
2117 | -- V | |
2118 | Instance.new("BlockMesh", torso) | |
2119 | Instance.new("BlockMesh", lArm) | |
2120 | Instance.new("BlockMesh", rArm) | |
2121 | Instance.new("BlockMesh", lLeg) | |
2122 | Instance.new("BlockMesh", rLeg) | |
2123 | ||
2124 | local camera = workspace.Camera | |
2125 | ||
2126 | local camPart = Instance.new("Part", camera) | |
2127 | camPart.Size = Vector3.new(0, 0, 0) | |
2128 | camPart.CFrame = camera.CFrame | |
2129 | camPart.CanCollide = false | |
2130 | camPart.Anchored = true | |
2131 | camPart.Transparency = 1 | |
2132 | ||
2133 | local cameraHand = Instance.new("Part", camera) | |
2134 | cameraHand.Size = Vector3.new(0.65, 1.95, 0.65) | |
2135 | cameraHand.CanCollide = false | |
2136 | cameraHand.Anchored = true | |
2137 | cameraHand.Name = "CameraHand" | |
2138 | putTexture(cameraHand, "rbxassetid://38934560", "rbxassetid://38934581", | |
2139 | "rbxassetid://38934613", "rbxassetid://38934568", | |
2140 | "rbxassetid://38934601", "rbxassetid://38934591", "Decal") | |
2141 | ||
2142 | local cameraHandItem = Instance.new("Part", camera) | |
2143 | cameraHandItem.Name = "CameraHandItem" | |
2144 | cameraHandItem.Size = Vector3.new(1.1, 1.1, 1.1) | |
2145 | cameraHandItem.Anchored = true | |
2146 | cameraHandItem.CanCollide = false | |
2147 | cameraHandItem.Transparency = 1 | |
2148 | ||
2149 | -- welding doesn't really work. | |
2150 | --local cameraHandWeld = Instance.new("Motor6D", camPart) | |
2151 | --cameraHandWeld.Part0 = camPart | |
2152 | --cameraHandWeld.Part1 = cameraHand | |
2153 | --cameraHandWeld.C0 = CFrame.new(5, 0, 0) | |
2154 | ||
2155 | local rootJoint = torso:FindFirstChild("RootJoint") or Instance.new("Motor6D", torso) | |
2156 | rootJoint.Name = "RootJoint" | |
2157 | rootJoint.Part0 = humRootPart | |
2158 | rootJoint.Part1 = torso | |
2159 | rootJoint.C1 = CFrame.new(0, 0.05, 0) | |
2160 | ||
2161 | local neck = torso:FindFirstChild("Neck") or Instance.new("Motor6D", torso) | |
2162 | neck.Name = "Neck" | |
2163 | neck.Part0 = head | |
2164 | neck.Part1 = torso | |
2165 | ||
2166 | local lS = torso:FindFirstChild("Left Shoulder") or Instance.new("Motor6D", torso) | |
2167 | lS.Name = "Left Shoulder" | |
2168 | lS.Part0 = lArm | |
2169 | lS.Part1 = torso | |
2170 | lS.C0 = CFrame.new(-0.325, 0.975, 0) * CFrame.Angles(0, 0, 0) | |
2171 | lS.C1 = CFrame.new(0.65, 0.975, 0) | |
2172 | ||
2173 | local rS = torso:FindFirstChild("Right Shoulder") or Instance.new("Motor6D", torso) | |
2174 | rS.Name = "Right Shoulder" | |
2175 | rS.Part0 = rArm | |
2176 | rS.Part1 = torso | |
2177 | rS.C0 = CFrame.new(-0.325, 0.975, 0) * CFrame.Angles(0, 0, 0) | |
2178 | rS.C1 = CFrame.new(-0.65, 0.975, 0) * CFrame.Angles(0, -math.rad(180), 0) | |
2179 | ||
2180 | local lH = torso:FindFirstChild("Left Hip") or Instance.new("Motor6D", torso) | |
2181 | lH.Name = "Left Hip" | |
2182 | lH.Part0 = lLeg | |
2183 | lH.Part1 = torso | |
2184 | lH.C0 = CFrame.new(0, 0.975, 0) | |
2185 | lH.C1 = CFrame.new(0.325, -0.975, 0) * CFrame.Angles(0, 0, 0) | |
2186 | ||
2187 | local rH = torso:FindFirstChild("Right Hip") or Instance.new("Motor6D", torso) | |
2188 | rH.Name = "Right Hip" | |
2189 | rH.Part0 = rLeg | |
2190 | rH.Part1 = torso | |
2191 | rH.C0 = CFrame.new(0, 0.975, 0) | |
2192 | rH.C1 = CFrame.new(-0.325, -0.975, 0) * CFrame.Angles(0, -math.rad(180), 0) | |
2193 | ||
2194 | for _,p in pairs(char:GetChildren()) do | |
2195 | if p.Name ~= "HumanoidRootPart" and p.ClassName == "Part" then | |
2196 | local hit = Instance.new("Part", char) | |
2197 | hit.Name = "DamagePart" | |
2198 | hit.BrickColor = BrickColor.new("Bright red") | |
2199 | hit.Material = "SmoothPlastic" | |
2200 | hit.Transparency = 1 | |
2201 | hit.Size = Vector3.new(p.Size.X + 0.05, p.Size.Y + 0.05, p.Size.Z + 0.05) | |
2202 | hit.CanCollide = false | |
2203 | weldTo(hit, p) | |
2204 | end | |
2205 | end | |
2206 | ||
2207 | wait(0.25) | |
2208 | ||
2209 | -- local billNameTag = Instance.new("BillboardGui", char) | |
2210 | -- billNameTag.Size = UDim2.new(1, 0, 1, 0) | |
2211 | -- billNameTag.Adornee = head | |
2212 | -- billNameTag.PlayerToHideFrom = player | |
2213 | -- | |
2214 | -- local textLabel = Instance.new("TextLabel", billNameTag) | |
2215 | -- textLabel.Font = "Arcade" | |
2216 | -- --textLabel.Size = UDim2.new(1, 0, 1, 0) | |
2217 | -- textLabel.TextScaled = true | |
2218 | -- --textLabel.TextSize = 100 | |
2219 | -- textLabel.Text = targetName | |
2220 | -- textLabel.Size = UDim2.new(textLabel.TextBounds.X/100, 0, 0.75, 0) | |
2221 | -- textLabel.BorderSizePixel = 0 | |
2222 | -- textLabel.BackgroundColor3 = Color3.new(0, 0, 0) | |
2223 | -- textLabel.TextColor3 = Color3.new(1, 1, 1) | |
2224 | -- textLabel.BackgroundTransparency = 0.5 | |
2225 | -- | |
2226 | -- if textLabel.Text == "Depr1" then | |
2227 | -- textLabel.TextColor3 = Color3.new(1, 0.75, 0) | |
2228 | -- end | |
2229 | -- | |
2230 | -- billNameTag.SizeOffset = Vector2.new(-textLabel.TextBounds.X/200 + 0.5, 0) | |
2231 | -- billNameTag.StudsOffset = Vector3.new(0, 1.5, 0) | |
2232 | ||
2233 | ||
2234 | humanoid.Parent = char | |
2235 | ||
2236 | local ticks = 0 | |
2237 | local times = 0 | |
2238 | ||
2239 | local walkAnim = 0 | |
2240 | local increaseWalkAnim = 1 | |
2241 | ||
2242 | local idleAnimRotX = 0 | |
2243 | local idleAnimRotZ = 0 | |
2244 | local sneaking = 0 | |
2245 | ||
2246 | --local RS = game:GetService("RunService").RenderStepped | |
2247 | local Mouse = player:GetMouse() | |
2248 | ||
2249 | local oldHP = humanoid.Health | |
2250 | local damageTime = 0 | |
2251 | ||
2252 | local punchRotX = 0 | |
2253 | local punchRotY = 0 | |
2254 | local punchRotZ = 0 | |
2255 | local punchRotXcam = 0 | |
2256 | local punchRotYcam = 0 | |
2257 | local punchRotZcam = 0 | |
2258 | local punchSpeed = 0 | |
2259 | local punching = 0 | |
2260 | local selectedBlock = 8 | |
2261 | local punchEnded = 1 | |
2262 | local itemOnHand = nil | |
2263 | ||
2264 | local selectBox = Instance.new("SelectionBox", camera) | |
2265 | selectBox.Transparency = 0.5 | |
2266 | selectBox.Color3 = Color3.new(0, 0, 0) | |
2267 | selectBox.LineThickness = 0 | |
2268 | ||
2269 | local handItem = Instance.new("Part", char) | |
2270 | handItem.Name = "HandItem" | |
2271 | handItem.Size = Vector3.new(0.52, 0.52, 0.52) | |
2272 | handItem.Transparency = 1 | |
2273 | handItem.CanCollide = false | |
2274 | ||
2275 | local handItemWeld = Instance.new("Weld", char) | |
2276 | handItemWeld.Part0 = handItem | |
2277 | handItemWeld.Part1 = lArm | |
2278 | handItemWeld.C1 = CFrame.new(0, -0.9, -0.6) * CFrame.Angles(math.rad(-10), math.rad(45), 0) | |
2279 | ||
2280 | local sound = Instance.new("Sound", char) | |
2281 | sound.Name = "Hurt" | |
2282 | sound.Volume = 10 | |
2283 | sound.SoundId = "rbxassetid://535690488" | |
2284 | ||
2285 | local facesToResize = {"Front", "Back", "Left", "Right", "Bottom", "Top"} | |
2286 | ||
2287 | local camCurrentZoom = (camera.CFrame.p - head.Position).magnitude | |
2288 | Mouse.Button1Down:connect(function() | |
2289 | if punchEnded == 1 then punching = 1 end | |
2290 | if Mouse.Target then | |
2291 | if getDistance(head.CFrame.p, Mouse.Hit.p) <= 10.4 then | |
2292 | local humanoid = Mouse.Target.Parent:FindFirstChild("Humanoid") | |
2293 | if humanoid then | |
2294 | humanoid.Health = humanoid.Health - 10 | |
2295 | local parts = Mouse.Target.Parent:GetChildren() | |
2296 | for _,p in pairs(parts) do | |
2297 | if p.ClassName == "Part" then | |
2298 | p.Velocity = Vector3.new(p.Velocity.X + (head.CFrame.lookVector.X * 18), p.Velocity.Y + (head.CFrame.lookVector.Y * 18) + 8, p.Velocity.Z + (head.CFrame.lookVector.Z * 18)) | |
2299 | end | |
2300 | end | |
2301 | return | |
2302 | end | |
2303 | local x = Mouse.Target.CFrame.p.X | |
2304 | local y = Mouse.Target.CFrame.p.Y | |
2305 | local z = Mouse.Target.CFrame.p.Z | |
2306 | if Mouse.TargetSurface.Name == "Right" then x = x + 2.6 end | |
2307 | if Mouse.TargetSurface.Name == "Left" then x = x - 2.6 end | |
2308 | if Mouse.TargetSurface.Name == "Top" then y = y + 2.6 end | |
2309 | if Mouse.TargetSurface.Name == "Bottom" then y = y - 2.6 end | |
2310 | if Mouse.TargetSurface.Name == "Back" then z = z + 2.6 end | |
2311 | if Mouse.TargetSurface.Name == "Front" then z = z - 2.6 end | |
2312 | if Mouse.Target.Size.X > 2.6 or Mouse.Target.Size.Y > 2.6 or Mouse.Target.Size.Z > 2.6 then | |
2313 | x = Mouse.Hit.p.X | |
2314 | y = Mouse.Hit.p.Y | |
2315 | z = Mouse.Hit.p.Z | |
2316 | end | |
2317 | -- local x = round(math.abs(mouseX)/2.6)*2.6 | |
2318 | -- local y = round(math.abs(mouseY)/2.6)*2.6 | |
2319 | -- local z = round(math.abs(mouseZ)/2.6)*2.6 | |
2320 | -- if Mouse.Hit.p.X < 0 then x = x * -1 end | |
2321 | -- if Mouse.Hit.p.Y < 0 then y = y * -1 end | |
2322 | -- if Mouse.Hit.p.Z < 0 then z = z * -1 end | |
2323 | local blk = placeBlock(toolBar[selectedBlock + 1], CFrame.new(SnapToGrid(x, 2.6), SnapToGrid(y, 2.6), SnapToGrid(z, 2.6)), Mouse) | |
2324 | if blk then | |
2325 | for _,f in pairs(facesToResize) do | |
2326 | blk:WaitForChild(f).StudsPerTileU = 2.6 | |
2327 | blk:WaitForChild(f).StudsPerTileV = 2.6 | |
2328 | end | |
2329 | end | |
2330 | end | |
2331 | end | |
2332 | end) | |
2333 | ||
2334 | local changedItem = false | |
2335 | local hasItemOnHand = 0 | |
2336 | local hi = 0 | |
2337 | -- selection thingy | |
2338 | local selectLabel = Instance.new("TextLabel", gui) | |
2339 | selectLabel.Size = UDim2.new(0, 32, 0, 32) | |
2340 | selectLabel.Position = UDim2.new(0.5, -160 + (selectedBlock*40), 1, -105) | |
2341 | selectLabel.BackgroundTransparency = 1 | |
2342 | selectLabel.BackgroundColor3 = Color3.new(1, 1, 1) | |
2343 | selectLabel.BorderSizePixel = 0 | |
2344 | selectLabel.Text = "" | |
2345 | selectLabel.ZIndex = 3 | |
2346 | ||
2347 | makeSquare(UDim2.new(0, -2, 0, 0), UDim2.new(0, 2, 0, 32), | |
2348 | Color3.new(88/255, 102/255, 85/255), 0, selectLabel, 3) | |
2349 | makeSquare(UDim2.new(0, -2, 0, -2), UDim2.new(0, 32, 0, 2), | |
2350 | Color3.new(88/255, 102/255, 85/255), 0, selectLabel, 3) | |
2351 | makeSquare(UDim2.new(0, -2, 0, 32), UDim2.new(0, 36, 0, 2), | |
2352 | Color3.new(212/255, 231/255, 207/255), 0, selectLabel, 3) | |
2353 | makeSquare(UDim2.new(0, 32, 0, 0), UDim2.new(0, 2, 0, 32), | |
2354 | Color3.new(212/255, 231/255, 207/255), 0, selectLabel, 3) | |
2355 | makeSquare(UDim2.new(0, 34, 0, -4), UDim2.new(0, 2, 0, 40), | |
2356 | Color3.new(163/255, 180/255, 159/255), 0, selectLabel, 3) | |
2357 | makeSquare(UDim2.new(0, -4, 0, -4), UDim2.new(0, 2, 0, 40), | |
2358 | Color3.new(163/255, 180/255, 159/255), 0, selectLabel, 3) | |
2359 | makeSquare(UDim2.new(0, -4, 0, -4), UDim2.new(0, 40, 0, 2), | |
2360 | Color3.new(163/255, 180/255, 159/255), 0, selectLabel, 3) | |
2361 | makeSquare(UDim2.new(0, 32, 0, -2), UDim2.new(0, 2, 0, 2), | |
2362 | Color3.new(163/255, 180/255, 159/255), 0, selectLabel, 3) | |
2363 | makeSquare(UDim2.new(0, -4, 0, 34), UDim2.new(0, 40, 0, 2), | |
2364 | Color3.new(163/255, 180/255, 159/255), 0, selectLabel, 3) | |
2365 | makeSquare(UDim2.new(0, -6, 0, -6), UDim2.new(0, 2, 0, 42), | |
2366 | Color3.new(212/255, 231/255, 207/255), 0, selectLabel, 3) | |
2367 | makeSquare(UDim2.new(0, -6, 0, -6), UDim2.new(0, 42, 0, 2), | |
2368 | Color3.new(212/255, 231/255, 207/255), 0, selectLabel, 3) | |
2369 | makeSquare(UDim2.new(0, 36, 0, -4), UDim2.new(0, 2, 0, 40), | |
2370 | Color3.new(88/255, 102/255, 85/255), 0, selectLabel, 3) | |
2371 | makeSquare(UDim2.new(0, 36, 0, -6), UDim2.new(0, 2, 0, 2), | |
2372 | Color3.new(163/255, 180/255, 159/255), 0, selectLabel, 3) | |
2373 | makeSquare(UDim2.new(0, 38, 0, -6), UDim2.new(0, 2, 0, 44), | |
2374 | Color3.new(0/255, 0/255, 0/255), 0.3, selectLabel, 3) | |
2375 | makeSquare(UDim2.new(0, -8, 0, -6), UDim2.new(0, 2, 0, 44), | |
2376 | Color3.new(0/255, 0/255, 0/255), 0.3, selectLabel, 3) | |
2377 | makeSquare(UDim2.new(0, -8, 0, -8), UDim2.new(0, 48, 0, 2), | |
2378 | Color3.new(0/255, 0/255, 0/255), 0, selectLabel, 3) | |
2379 | -- | |
2380 | local oldItemOnHand = itemOnHand | |
2381 | function updateItemOnHand() | |
2382 | for _,d in pairs(handItem:GetChildren()) do | |
2383 | d:Destroy() | |
2384 | end | |
2385 | for _,d in pairs(cameraHandItem:GetChildren()) do | |
2386 | d:Destroy() | |
2387 | end | |
2388 | if itemOnHand ~= nil then | |
2389 | putTexture(handItem, itemOnHand.frontTex, itemOnHand.backTex, | |
2390 | itemOnHand.topTex, itemOnHand.bottomTex, | |
2391 | itemOnHand.leftTex, itemOnHand.rightTex, "Texture") | |
2392 | ||
2393 | putTexture(cameraHandItem, itemOnHand.frontTex, itemOnHand.backTex, | |
2394 | itemOnHand.topTex, itemOnHand.bottomTex, | |
2395 | itemOnHand.leftTex, itemOnHand.rightTex, "Texture") | |
2396 | ||
2397 | for _,f in pairs(facesToResize) do | |
2398 | handItem:WaitForChild(f).StudsPerTileU = 0.52 | |
2399 | handItem:WaitForChild(f).StudsPerTileV = 0.52 | |
2400 | end | |
2401 | ||
2402 | for _,f in pairs(facesToResize) do | |
2403 | cameraHandItem:WaitForChild(f).StudsPerTileU = 1.1 | |
2404 | cameraHandItem:WaitForChild(f).StudsPerTileV = 1.1 | |
2405 | end | |
2406 | ||
2407 | cameraHand.Transparency = 1 | |
2408 | for _,f in pairs(facesToResize) do | |
2409 | cameraHand:WaitForChild(f).Transparency = 1 | |
2410 | cameraHand:WaitForChild(f).Transparency = 1 | |
2411 | end | |
2412 | else | |
2413 | cameraHand.Transparency = 0 | |
2414 | for _,f in pairs(facesToResize) do | |
2415 | cameraHand:WaitForChild(f).Transparency = 0 | |
2416 | cameraHand:WaitForChild(f).Transparency = 0 | |
2417 | end | |
2418 | end | |
2419 | if oldItemOnHand ~= itemOnHand then | |
2420 | changedItem = true | |
2421 | end | |
2422 | end | |
2423 | ||
2424 | local pressedWTimes = 0 | |
2425 | local sprintingNum = 0 | |
2426 | local sprinting = false | |
2427 | Mouse.KeyDown:connect(function(key) | |
2428 | if sprinting == false then sprintingNum = 0 else sprintingNum = 1 end | |
2429 | if (key == "w" and sprinting == false and sneaking == 0) then | |
2430 | if pressedWTimes >= 1 or key == Enum.KeyCode.LeftControl then | |
2431 | sprinting = true | |
2432 | humanoid.WalkSpeed = humanoid.WalkSpeed * 1.5 | |
2433 | pressedWTimes = 0 | |
2434 | coroutine.resume(coroutine.create(function() | |
2435 | for i = 1, 24 do | |
2436 | camera.FieldOfView = camera.FieldOfView + ((24-i)/10) | |
2437 | RS:wait() | |
2438 | end | |
2439 | end)) | |
2440 | end | |
2441 | pressedWTimes = pressedWTimes + 1 | |
2442 | coroutine.resume(coroutine.create(function() | |
2443 | for i = 1, 9 do | |
2444 | if sprinting == true then break end | |
2445 | wait() | |
2446 | end | |
2447 | pressedWTimes = 0 | |
2448 | end)) | |
2449 | end | |
2450 | if key == "q" and sprinting == false then | |
2451 | sneaking = 1 | |
2452 | humanoid.WalkSpeed = humanoid.WalkSpeed / 2 | |
2453 | humanoid.HipHeight = humanoid.HipHeight - 0.35 | |
2454 | rootJoint.C1 = CFrame.new(0, 0.325, 0) * CFrame.Angles(math.rad(sneaking*45), 0, 0) | |
2455 | lH.C0 = CFrame.new(0, 0.975, 0) * CFrame.Angles(-math.rad(sneaking*45), 0, 0) | |
2456 | rH.C0 = CFrame.new(0, 0.975, 0) * CFrame.Angles(math.rad(sneaking*45), 0, 0) | |
2457 | --print("Sneaking...") | |
2458 | end | |
2459 | if key == "e" then | |
2460 | if creativeInventoryGUI.Visible == true then | |
2461 | creativeInventoryGUI.Visible = false | |
2462 | elseif creativeInventoryGUI.Visible == false then | |
2463 | creativeInventoryGUI.Visible = true | |
2464 | end | |
2465 | end | |
2466 | if key == "1" or key == "2" or key == "3" or | |
2467 | key == "4" or key == "5" or key == "6" or | |
2468 | key == "7" or key == "8" or key == "9" then | |
2469 | selectedBlock = tonumber(key) - 1 | |
2470 | oldItemOnHand = itemOnHand | |
2471 | itemOnHand = toolBar[tonumber(key)] | |
2472 | updateItemOnHand() | |
2473 | if hasItemOnHand == 0 and itemOnHand then hi = 1 end | |
2474 | if hasItemOnHand == 1 and itemOnHand == nil then hi = 1 end | |
2475 | end | |
2476 | --if (key == "0" or key == "1" or key == "2" | |
2477 | -- or key == "3" or key == "4" or key == "5" | |
2478 | -- or key == "6" or key == "7") and hasItemOnHand == 0 then hi = 1 end | |
2479 | selectLabel.Position = UDim2.new(0.5, -160 + ((selectedBlock)*40), 1, -105) | |
2480 | end) | |
2481 | ||
2482 | local interrump = false | |
2483 | game:GetService('RunService'):BindToRenderStep('Camera', Enum.RenderPriority.Camera.Value, function() | |
2484 | if humanoid.Health < oldHP then | |
2485 | interrump = true | |
2486 | RS:wait() | |
2487 | interrump = false | |
2488 | for i = 1, 15 do | |
2489 | if interrump == true then interrump = false break end | |
2490 | camera.CFrame = camera.CFrame * CFrame.Angles(0, 0, -math.rad(15-i)) | |
2491 | RS:wait() | |
2492 | end | |
2493 | end | |
2494 | end) | |
2495 | ||
2496 | local changedPerspective = 0 | |
2497 | Mouse.KeyUp:connect(function(key) | |
2498 | if sprinting == false then sprintingNum = 0 else sprintingNum = 1 end | |
2499 | if (key == "w" and sprinting == true and sneaking == 0) then | |
2500 | sprinting = false | |
2501 | humanoid.WalkSpeed = humanoid.WalkSpeed / 1.5 | |
2502 | coroutine.resume(coroutine.create(function() | |
2503 | for i = 1, 24 do | |
2504 | camera.FieldOfView = camera.FieldOfView - ((24-i)/10) | |
2505 | RS:wait() | |
2506 | end | |
2507 | end)) | |
2508 | end | |
2509 | if key == "q" and sprinting == false then | |
2510 | sneaking = 0 | |
2511 | humanoid.WalkSpeed = humanoid.WalkSpeed * 2 | |
2512 | humanoid.HipHeight = humanoid.HipHeight + 0.35 | |
2513 | rootJoint.C1 = CFrame.new(0, 0.05, 0) * CFrame.Angles(0, 0, 0) | |
2514 | lH.C0 = CFrame.new(0, 0.975, 0) * CFrame.Angles(0, 0, 0) | |
2515 | rH.C0 = CFrame.new(0, 0.975, 0) * CFrame.Angles(0, 0, 0) | |
2516 | --print("Stopped sneaking...") | |
2517 | end | |
2518 | if key == "r" then | |
2519 | if changedPerspective == 0 then | |
2520 | changedPerspective = 1 | |
2521 | camera.CFrame = camera.CFrame * CFrame.Angles(0, math.rad(180), 0) | |
2522 | elseif changedPerspective == 1 then | |
2523 | changedPerspective = 0 | |
2524 | camera.CFrame = camera.CFrame * CFrame.Angles(0, math.rad(-180), 0) | |
2525 | end | |
2526 | end | |
2527 | end) | |
2528 | ||
2529 | Mouse.TargetFilter = camera | |
2530 | ||
2531 | local dead = false | |
2532 | local humOffset = CFrame.new(0, 0, 0) | |
2533 | local camHandY = 0 | |
2534 | local camHandZ = 0 | |
2535 | local cameraHandCFrame = CFrame.new(1.15, -1.35, -2) * CFrame.fromEulerAnglesXYZ(math.rad(90), math.rad(55), math.rad(20)) | |
2536 | local bodyRot = CFrame.new(0, 0, 0) | |
2537 | local lastCamRot = camPart.Orientation | |
2538 | while RS:wait() do | |
2539 | hearts.Size = UDim2.new(0, SnapToGrid((humanoid.Health/humanoid.MaxHealth)*162, 8) + 2, 0, 18) | |
2540 | camCurrentZoom = ((CFrame.new(0, -1*sneaking, 0) * camera.CFrame).p - head.Position).magnitude | |
2541 | if itemOnHand ~= nil then | |
2542 | hasItemOnHand = 1 | |
2543 | handItem.Transparency = itemOnHand.transparency | |
2544 | else | |
2545 | hasItemOnHand = 0 | |
2546 | handItem.Transparency = 1 | |
2547 | end | |
2548 | if humanoid.Health <= 0 and dead == false then | |
2549 | dead = true | |
2550 | local corpseCF = humRootPart.CFrame + Vector3.new(0, -2.925, 0) | |
2551 | local corpse = Instance.new("Part", workspace) | |
2552 | corpse.Name = "Dead Corpse" | |
2553 | corpse.Size = Vector3.new(3, 1, 3) | |
2554 | corpse.CFrame = corpseCF | |
2555 | corpse.Transparency = 1 | |
2556 | corpse.CustomPhysicalProperties = PhysicalProperties.new(1, 1, 0, 1, 1) | |
2557 | ||
2558 | local dHead = Instance.new("Part", corpse) | |
2559 | dHead.CanCollide = false | |
2560 | dHead.Material = "Fabric" | |
2561 | ||
2562 | local dTorso = Instance.new("Part", corpse) | |
2563 | dTorso.CanCollide = false | |
2564 | dTorso.Material = "Fabric" | |
2565 | ||
2566 | local dLArm = Instance.new("Part", corpse) | |
2567 | dLArm.CanCollide = false | |
2568 | dLArm.Material = "Fabric" | |
2569 | ||
2570 | local dRArm = Instance.new("Part", corpse) | |
2571 | dRArm.CanCollide = false | |
2572 | dRArm.Material = "Fabric" | |
2573 | ||
2574 | local dLLeg = Instance.new("Part", corpse) | |
2575 | dLLeg.CanCollide = false | |
2576 | dLLeg.Material = "Fabric" | |
2577 | ||
2578 | local dRLeg = Instance.new("Part", corpse) | |
2579 | dRLeg.CanCollide = false | |
2580 | dRLeg.Material = "Fabric" | |
2581 | ||
2582 | dHead.Size = Vector3.new(1.3, 1.3, 1.3) | |
2583 | putTexture(dHead, "rbxassetid://38738031", "rbxassetid://36047330", | |
2584 | "rbxassetid://36047341", "rbxassetid://36047347", | |
2585 | "rbxassetid://36047323", "rbxassetid://36047315", "Decal") | |
2586 | ||
2587 | dTorso.Size = Vector3.new(1.3, 1.95, 0.65) | |
2588 | putTexture(dTorso, "rbxassetid://38934753", "rbxassetid://38934731", | |
2589 | "rbxassetid://38934780", "rbxassetid://38934740", | |
2590 | "rbxassetid://38934762", "rbxassetid://38934762", "Decal") | |
2591 | ||
2592 | dLArm.Size = Vector3.new(0.65, 1.95, 0.65) | |
2593 | putTexture(dLArm, "rbxassetid://38934581", "rbxassetid://38934560", | |
2594 | "rbxassetid://38934613", "rbxassetid://38934568", | |
2595 | "rbxassetid://38934601", "rbxassetid://38934591", "Decal") | |
2596 | ||
2597 | dRArm.Size = Vector3.new(0.65, 1.95, 0.65) | |
2598 | putTexture(dRArm, "rbxassetid://38934560", "rbxassetid://38934581", | |
2599 | "rbxassetid://38934613", "rbxassetid://38934568", | |
2600 | "rbxassetid://38934601", "rbxassetid://38934591", "Decal") | |
2601 | ||
2602 | dLLeg.Size = Vector3.new(0.65, 1.95, 0.65) | |
2603 | putTexture(dLLeg, "rbxassetid://38936226", "rbxassetid://38936209", | |
2604 | "rbxassetid://38934719", "rbxassetid://38934712", | |
2605 | "rbxassetid://38936255", "rbxassetid://38936242", "Decal") | |
2606 | ||
2607 | dRLeg.Size = Vector3.new(0.65, 1.95, 0.65) | |
2608 | putTexture(dRLeg, "rbxassetid://38936209", "rbxassetid://38936226", | |
2609 | "rbxassetid://38934719", "rbxassetid://38934712", | |
2610 | "rbxassetid://38936242", "rbxassetid://38936255", "Decal") | |
2611 | ||
2612 | local weldCorpse = weldTo(dTorso, corpse) | |
2613 | weldCorpse.C0 = CFrame.new(0, -1.95 - 0.4, 0) | |
2614 | ||
2615 | -- lazy naming... | |
2616 | ||
2617 | local weld1 = weldTo(dTorso, dHead) | |
2618 | weld1.C0 = CFrame.new(0, 1.625, 0) | |
2619 | ||
2620 | local weld2 = weldTo(dTorso, dLArm) | |
2621 | weld2.C0 = CFrame.new(0.325, 0.975, 0) * CFrame.Angles(0, 0, 0) | |
2622 | weld2.C1 = CFrame.new(-0.65, 0.975, 0) | |
2623 | ||
2624 | local weld3 = weldTo(dTorso, dRArm) | |
2625 | weld3.C0 = CFrame.new(-0.325, 0.975, 0) * CFrame.Angles(0, 0, 0) | |
2626 | weld3.C1 = CFrame.new(-0.65, 0.975, 0) * CFrame.Angles(0, -math.rad(180), 0) | |
2627 | ||
2628 | local weld4 = weldTo(dTorso, dLLeg) | |
2629 | weld4.C0 = CFrame.new(0, -0.975, 0) | |
2630 | weld4.C1 = CFrame.new(-0.325, 0.975, 0) * CFrame.Angles(0, 0, 0) | |
2631 | ||
2632 | local weld5 = weldTo(dTorso, dRLeg) | |
2633 | weld5.C0 = CFrame.new(0, -0.975, 0) | |
2634 | weld5.C1 = CFrame.new(-0.325, 0.975, 0) * CFrame.Angles(0, -math.rad(180), 0) | |
2635 | ||
2636 | for _,p in pairs(corpse:GetChildren()) do | |
2637 | if p.ClassName == "Part" then | |
2638 | local hit = Instance.new("Part", p) | |
2639 | hit.Name = "DamagePart" | |
2640 | hit.BrickColor = BrickColor.new("Bright red") | |
2641 | hit.Material = "SmoothPlastic" | |
2642 | hit.Transparency = 0.5 | |
2643 | hit.Size = Vector3.new(p.Size.X + 0.05, p.Size.Y + 0.05, p.Size.Z + 0.05) | |
2644 | hit.CanCollide = false | |
2645 | weldTo(hit, p) | |
2646 | end | |
2647 | end | |
2648 | ||
2649 | head.Parent = nil | |
2650 | torso.Parent = nil | |
2651 | lArm.Parent = nil | |
2652 | rArm.Parent = nil | |
2653 | lLeg.Parent = nil | |
2654 | rLeg.Parent = nil | |
2655 | ||
2656 | weldTo(dTorso, humRootPart) | |
2657 | ||
2658 | coroutine.resume(coroutine.create(function() | |
2659 | for i = 1, 55 do | |
2660 | corpse.CFrame = corpseCF --* | |
2661 | --CFrame.Angles(math.rad(-corpse.Orientation.X), 0, math.rad(-corpse.Orientation.Z)) | |
2662 | ||
2663 | weldCorpse.C1 = weldCorpse.C1:lerp(CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, math.rad(90)), 0.075) | |
2664 | RS:wait() | |
2665 | end | |
2666 | for _,p in pairs(corpse:GetChildren()) do | |
2667 | p:Destroy() | |
2668 | end | |
2669 | ||
2670 | corpse.Anchored = true | |
2671 | ||
2672 | local smoke = Instance.new("ParticleEmitter", corpse) | |
2673 | smoke.Size = NumberSequence.new({ | |
2674 | NumberSequenceKeypoint.new(0, 0.6), | |
2675 | NumberSequenceKeypoint.new(1, 0.6) | |
2676 | }) | |
2677 | smoke.Texture = "rbxassetid://1494734425" | |
2678 | smoke.Rate = 100 | |
2679 | smoke.Lifetime = NumberRange.new(0.6, 1.2) | |
2680 | smoke.Speed = NumberRange.new(2, 5) | |
2681 | smoke.SpreadAngle = Vector2.new(-30, 30) | |
2682 | ||
2683 | wait(0.07) | |
2684 | ||
2685 | smoke.Enabled = false | |
2686 | ||
2687 | wait(2) | |
2688 | ||
2689 | corpse:Destroy() | |
2690 | end)) | |
2691 | print("You died!") | |
2692 | end | |
2693 | if humanoid.Health < oldHP then | |
2694 | damageTime = 60 | |
2695 | sound:Play() | |
2696 | end | |
2697 | oldHP = humanoid.Health | |
2698 | if damageTime > 0 and humanoid.Health > 0 then | |
2699 | for _,p in pairs(char:GetChildren()) do | |
2700 | if p.Name ~= "HumanoidRootPart" and p.ClassName == "Part" then | |
2701 | if p.Name == "DamagePart" then | |
2702 | p.Transparency = 0.5 | |
2703 | end | |
2704 | end | |
2705 | end | |
2706 | damageTime = damageTime - 2 | |
2707 | if damageTime <= 0 then | |
2708 | for _,p in pairs(char:GetChildren()) do | |
2709 | if p.Name ~= "HumanoidRootPart" and p.ClassName == "Part" then | |
2710 | if p.Name == "DamagePart" then | |
2711 | p.Transparency = 1 | |
2712 | end | |
2713 | end | |
2714 | end | |
2715 | end | |
2716 | end | |
2717 | camPart.CFrame = camera.CFrame * CFrame.Angles(0, math.rad(changedPerspective*180), 0) | |
2718 | ||
2719 | if getMagnitudeXZ(torso.Velocity) > 1 then | |
2720 | if walkAnim >= 1 then | |
2721 | increaseWalkAnim = -1 | |
2722 | elseif walkAnim <= -1 then | |
2723 | increaseWalkAnim = 1 | |
2724 | end | |
2725 | walkAnim = walkAnim + (increaseWalkAnim/(10+(sneaking*20))) * ((5 + getMagnitudeXZ(torso.Velocity))/20) | |
2726 | else | |
2727 | walkAnim = 0 | |
2728 | end | |
2729 | ||
2730 | --lH.C0 = CFrame.new(0, 0.975, 0) * CFrame.Angles(-math.rad(sneaking*45), 0, 0) | |
2731 | --rH.C0 = CFrame.new(0, 0.975, 0) * CFrame.Angles(math.rad(sneaking*45), 0, 0) | |
2732 | lH.C0 = lH.C0:lerp(CFrame.new(0, 0.975, 0) * CFrame.Angles(math.max(math.rad(-60), math.min(math.rad(60), -math.rad(sneaking*45) + math.rad(damageTime*1.5) + math.rad(walkAnim*getMagnitudeXZ(torso.Velocity)*5/(1+sneaking)))), 0, 0), 0.15) | |
2733 | rH.C0 = rH.C0:lerp(CFrame.new(0, 0.975, 0) * CFrame.Angles(math.max(math.rad(-60), math.min(math.rad(60), math.rad(sneaking*45) + math.rad(damageTime*1.5) + math.rad(walkAnim*getMagnitudeXZ(torso.Velocity)*5/(1+sneaking)))), 0, 0), 0.15) | |
2734 | -- | |
2735 | --rootJoint.C0 = CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0) | |
2736 | --print(math.abs(head.Orientation.Y) - math.abs(humRootPart.Orientation.Y)) | |
2737 | --if (head.Orientation.Y * 2) - (head.Orientation.Y + torso.Orientation.Y) > 45 then | |
2738 | --humRootPart.CFrame = humRootPart.CFrame * CFrame.Angles(0, math.rad(-45 + head.Orientation.Y), 0) | |
2739 | --print("-45") | |
2740 | --end | |
2741 | --if (head.Orientation.Y * 2) - (head.Orientation.Y + torso.Orientation.Y) < -45 then | |
2742 | --humRootPart.CFrame = humRootPart.CFrame * CFrame.Angles(0, math.rad(45 + head.Orientation.Y), 0) | |
2743 | --print("45") | |
2744 | --end | |
2745 | ||
2746 | if changedItem then | |
2747 | changedItem = false | |
2748 | coroutine.resume(coroutine.create(function() | |
2749 | for i = 1, 8 do | |
2750 | camHandY = camHandY - 0.2 | |
2751 | RS:wait() | |
2752 | end | |
2753 | for i = 1, 8 do | |
2754 | camHandY = camHandY + 0.2 | |
2755 | RS:wait() | |
2756 | end | |
2757 | end)) | |
2758 | end | |
2759 | ||
2760 | --move these arms | |
2761 | rootJoint.C1 = rootJoint.C1:lerp(CFrame.new(0, 0.325, 0) * CFrame.Angles(math.rad(sneaking*45), math.rad(punchRotY), 0), 0.2) | |
2762 | ||
2763 | lS.C0 = lS.C0:lerp(CFrame.new(-0.325, 0.975, 0) * CFrame.Angles(math.max(math.rad(-60), math.min(math.rad(60), idleAnimRotX/20 + math.rad(-hasItemOnHand*10) + math.rad(punchRotX) + math.rad(damageTime*1.5) + math.rad(walkAnim*getMagnitudeXZ(torso.Velocity)*5/(1+sneaking)))), 0, math.rad(punchRotZ) + idleAnimRotZ/20), 0.025+(math.min(1, getMagnitudeXZ(torso.Velocity))/12)*2 + divide(punchSpeed, 6) + hi) | |
2764 | rS.C0 = rS.C0:lerp(CFrame.new(-0.325, 0.975, 0) * CFrame.Angles(math.max(math.rad(-60), math.min(math.rad(60), idleAnimRotX/20 + math.rad(damageTime*1.5) + math.rad(walkAnim*getMagnitudeXZ(torso.Velocity)*5/(1+sneaking)))), 0, idleAnimRotZ/20), 0.025+(math.min(1, getMagnitudeXZ(torso.Velocity))/12)*2) | |
2765 | ||
2766 | if Mouse.Target and getDistance(head.CFrame.p, Mouse.Hit.p) <= 10.4 then | |
2767 | if Mouse.Target.Parent:FindFirstChild("Humanoid") == nil and Mouse.Target.Parent ~= camera then | |
2768 | selectBox.Adornee = Mouse.Target | |
2769 | else | |
2770 | selectBox.Adornee = nil | |
2771 | end | |
2772 | else | |
2773 | selectBox.Adornee = nil | |
2774 | end | |
2775 | ||
2776 | --local neckYRot = math.rad(camPart.Orientation.Y - torso.Orientation.Y) | |
2777 | ||
2778 | --neck.C1 = CFrame.new(0, 0.975, 0) * CFrame.fromEulerAnglesXYZ(math.rad(sneaking*45), neckYRot, 0) | |
2779 | --neck.C0 = CFrame.new(0, -0.65, 0) * CFrame.Angles(-math.rad(camPart.Orientation.X - torso.Orientation.X - (sneaking*45)), 0, 0) | |
2780 | ||
2781 | --print(AngleDifference(camPart.Orientation, torso.Orientation).Y) | |
2782 | ||
2783 | local negate = 1 | |
2784 | if torso.Velocity.Y < 0 then | |
2785 | negate = -1 | |
2786 | end | |
2787 | ||
2788 | --local vel = math.log(math.abs(torso.Velocity.Y))*negate | |
2789 | --if vel == math.huge or vel == -math.huge then vel = 0.1 end | |
2790 | --local vel = torso.Velocity.Y^0.6 | |
2791 | ||
2792 | local BobbingY = walkAnim*2 | |
2793 | if BobbingY >= 1 then BobbingY = 1 BobbingY = -BobbingY end | |
2794 | ||
2795 | local rotationSpeed = AngleDifference(camPart.Orientation, lastCamRot) | |
2796 | ||
2797 | local BobbingX = -0.5 + walkAnim | |
2798 | ||
2799 | --cameraHandCFrame = cameraHandCFrame:lerp(CFrame.new(1.15*1.3 + (walkAnim/2 - (walkAnim/4)), -1.35*1.3 + camHandY + (-BobbingY/8) + 0, -0.45 + -camHandZ + ((camera.FieldOfView/45)-1.6)*1.3) * CFrame.Angles(math.rad(punchRotXcam), math.rad(punchRotYcam), math.rad(punchRotZcam)) * CFrame.new(0, 0, -1.75) * CFrame.fromEulerAnglesXYZ(math.rad(85), math.rad(55), math.rad(22.5)), 0.25) | |
2800 | cameraHandCFrame = cameraHandCFrame:lerp(CFrame.Angles(math.rad(rotationSpeed.X/1.5), math.rad(rotationSpeed.Y/1.5), math.rad(rotationSpeed.Z/1.5)) * CFrame.new(1.15*1.3 + (BobbingX/3.5), -1.35*1.3 + camHandY + ((0.4-BobbingY)/7) + 0, -0.45 + -camHandZ + ((camera.FieldOfView/45)-1.6)*1.3) * CFrame.Angles(math.rad(punchRotXcam), math.rad(punchRotYcam), math.rad(punchRotZcam)) * CFrame.new(0, 0, -1.75) * CFrame.fromEulerAnglesXYZ(math.rad(85), math.rad(55), math.rad(22.5)), 0.25) | |
2801 | ||
2802 | humOffset = humOffset:lerp(CFrame.new(walkAnim/4 - (walkAnim/8), BobbingY/13, 0), 0.25) | |
2803 | humanoid.CameraOffset = Vector3.new(humOffset.X, humOffset.Y, 0) | |
2804 | ||
2805 | cameraHand.CFrame = camPart.CFrame * cameraHandCFrame | |
2806 | ||
2807 | cameraHandItem.CFrame = cameraHand.CFrame * CFrame.new(0, -0.5, 0) * CFrame.Angles(math.rad(-210), math.rad(-40), math.rad(-100)) * CFrame.new(0, -0.35, 0) | |
2808 | ||
2809 | if camCurrentZoom >= 1.5 then | |
2810 | cameraHand.Transparency = 1 | |
2811 | for _,t in pairs(cameraHand:GetChildren()) do | |
2812 | if t.Transparency == 0 then | |
2813 | t.Transparency = 1 | |
2814 | end | |
2815 | end | |
2816 | for _,t in pairs(cameraHandItem:GetChildren()) do | |
2817 | if t.Transparency == 0 then | |
2818 | t.Transparency = 1 | |
2819 | end | |
2820 | end | |
2821 | else | |
2822 | changedPerspective = 0 | |
2823 | cameraHand.Transparency = hasItemOnHand | |
2824 | for _,t in pairs(cameraHand:GetChildren()) do | |
2825 | if t.Transparency == 1 then | |
2826 | t.Transparency = hasItemOnHand | |
2827 | end | |
2828 | end | |
2829 | for _,t in pairs(cameraHandItem:GetChildren()) do | |
2830 | if t.Transparency == 1 then | |
2831 | t.Transparency = 0 | |
2832 | end | |
2833 | end | |
2834 | end | |
2835 | ||
2836 | if updateHand == true then | |
2837 | updateHand = false | |
2838 | updateItemOnHand() | |
2839 | end | |
2840 | ||
2841 | if punching == 1 and punchEnded == 1 then | |
2842 | punching = 0 | |
2843 | --print("steve uses punch!!") | |
2844 | local coPunchCam = coroutine.wrap(function() | |
2845 | local mult = 2.25 | |
2846 | punchRotXcam = 40/2*mult | |
2847 | punchRotYcam = 25/2*mult | |
2848 | camHandZ = 2.5 | |
2849 | wait(0.075/4) | |
2850 | punchRotXcam = 50/2*mult | |
2851 | punchRotYcam = 25*mult | |
2852 | punchRotZcam = -10*mult | |
2853 | camHandZ = 1 | |
2854 | wait(0.075/4) | |
2855 | punchRotYcam = 50/1.5*mult | |
2856 | punchRotXcam = -10*mult | |
2857 | --wait(0.075/2) | |
2858 | --punchRotYcam = 50 | |
2859 | --punchRotXcam = -10 | |
2860 | wait(0.02) | |
2861 | punchRotXcam = -20*mult | |
2862 | wait(0.055) | |
2863 | camHandZ = 0 | |
2864 | punchRotXcam = 0 | |
2865 | punchRotYcam = 0 | |
2866 | punchRotZcam = 0 | |
2867 | end) | |
2868 | local coPunch = coroutine.wrap(function() | |
2869 | punchEnded = 0 | |
2870 | punchSpeed = 1 | |
2871 | punchRotX = -60 | |
2872 | punchRotY = -8 | |
2873 | punchRotZ = -35 | |
2874 | ||
2875 | wait(0.075/1.3) | |
2876 | punchSpeed = 1 | |
2877 | punchRotX = -75 | |
2878 | punchRotY = 8 | |
2879 | punchRotZ = 40 | |
2880 | wait(0.075/1.3) | |
2881 | punchSpeed = 1 | |
2882 | punchRotX = -20 | |
2883 | punchRotZ = 40 | |
2884 | wait(0.075/1.3) | |
2885 | punchSpeed = 3.5 | |
2886 | punchRotX = 0 | |
2887 | punchRotY = 0 | |
2888 | punchRotZ = 0 | |
2889 | ||
2890 | punchRotXcam = 0 | |
2891 | punchRotYcam = 0 | |
2892 | punchRotZcam = 0 | |
2893 | ||
2894 | punchEnded = 1 | |
2895 | wait(0.06/1.3) | |
2896 | punchSpeed = 0 | |
2897 | end) | |
2898 | coPunch() | |
2899 | coPunchCam() | |
2900 | end | |
2901 | if ticks > 20 then | |
2902 | ticks = 0 | |
2903 | if times == 0 then | |
2904 | times = times + 1 | |
2905 | idleAnimRotX = -1 | |
2906 | idleAnimRotZ = 0 | |
2907 | elseif times == 1 then | |
2908 | times = times + 1 | |
2909 | idleAnimRotX = -0.75 | |
2910 | idleAnimRotZ = -0.75 | |
2911 | elseif times == 2 then | |
2912 | times = times + 1 | |
2913 | idleAnimRotX = 0 | |
2914 | idleAnimRotZ = -1 | |
2915 | elseif times == 3 then | |
2916 | times = times + 1 | |
2917 | idleAnimRotX = 0.75 | |
2918 | idleAnimRotZ = -0.75 | |
2919 | --idleAnimRotX = 0.75 | |
2920 | --idleAnimRotZ = -0 | |
2921 | elseif times == 4 then | |
2922 | times = times + 1 | |
2923 | idleAnimRotX = 1 | |
2924 | idleAnimRotZ = 0 | |
2925 | --idleAnimRotX = 1 | |
2926 | --idleAnimRotZ = 0 | |
2927 | elseif times == 5 then | |
2928 | times = times + 1 | |
2929 | idleAnimRotX = 0.75 | |
2930 | idleAnimRotZ = 0.75 | |
2931 | elseif times == 6 then | |
2932 | times = times + 1 | |
2933 | idleAnimRotX = 0 | |
2934 | idleAnimRotZ = 1 | |
2935 | elseif times == 7 then | |
2936 | times = 0 | |
2937 | idleAnimRotX = -0.75 | |
2938 | idleAnimRotZ = 0.75 | |
2939 | end | |
2940 | end | |
2941 | ||
2942 | if hi == 1 then hi = 0 end | |
2943 | ||
2944 | local rotX = math.deg(math.atan2(humanoid.MoveDirection.Z, humanoid.MoveDirection.X)) + 90 | |
2945 | if humanoid.MoveDirection ~= Vector3.new(0, 0, 0) then | |
2946 | --print(rotX) | |
2947 | bodyRot = bodyRot:lerp(CFrame.Angles(0, -math.rad(rotX), 0), 0.125) | |
2948 | humRootPart.CFrame = CFrame.new(humRootPart.CFrame.p.X, humRootPart.CFrame.p.Y, humRootPart.CFrame.p.Z) * bodyRot | |
2949 | end | |
2950 | local neckYRot = math.rad(camPart.Orientation.Y - torso.Orientation.Y) | |
2951 | neck.C1 = CFrame.new(0, 0.975, 0) * CFrame.fromEulerAnglesXYZ(math.rad(sneaking*45), neckYRot, 0) | |
2952 | neck.C0 = CFrame.new(0, -0.65, 0) * CFrame.Angles(-math.rad(camPart.Orientation.X - torso.Orientation.X - (sneaking*45)), 0, 0) | |
2953 | ||
2954 | local oldTorsoOrientation = torso.Orientation | |
2955 | if AngleDifference(camPart.Orientation, torso.Orientation).Y > 45 then | |
2956 | humRootPart.CFrame = CFrame.new(humRootPart.CFrame.p.X, humRootPart.CFrame.p.Y, humRootPart.CFrame.p.Z) * CFrame.Angles(0, math.rad(head.Orientation.Y + 45), 0) | |
2957 | bodyRot = CFrame.Angles(0, math.rad(head.Orientation.Y + 45), 0) | |
2958 | --print("-45") | |
2959 | elseif AngleDifference(camPart.Orientation, torso.Orientation).Y < -45 then | |
2960 | humRootPart.CFrame = CFrame.new(humRootPart.CFrame.p.X, humRootPart.CFrame.p.Y, humRootPart.CFrame.p.Z) * CFrame.Angles(0, math.rad(head.Orientation.Y - 45), 0) | |
2961 | bodyRot = CFrame.Angles(0, math.rad(head.Orientation.Y - 45), 0) | |
2962 | --print("45") | |
2963 | end | |
2964 | ||
2965 | lastCamRot = camPart.Orientation | |
2966 | neck.C1 = neck.C1 * CFrame.fromEulerAnglesXYZ(0, -math.rad(AngleDifference(oldTorsoOrientation, torso.Orientation).Y), 0) | |
2967 | ticks = ticks + 1 | |
2968 | end | |
2969 | end | |
2970 | end |