View difference between Paste ID: EHWbzG5P and yQ5Ev2m9
SHOW: | | - or go back to the newest paste.
1
-- This script has been converted to FE by iPxter
2
 
3
 
4
if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
5
local player,local ,plr,Mouse,mouse,UserInputService,ContextActionService = owner
6
do
7
    print("FE Compatibility code by Mokiros | Translated to FE by iPxter")
8
    script.Parent = Player.Character
9
 
10
    --RemoteEvent for communicating
11
    local Event = Instance.new("RemoteEvent")
12
    Event.Name = "UserInput_Event"
13
 
14
    --Fake event to make stuff like Mouse.KeyDown work
15
    local function fakeEvent()
16
        local t = {_fakeEvent=true,Connect=function(self,f)self.Function=f end}
17
        t.connect = t.Connect
18
        return t
19
    end
20
 
21
    --Creating fake input objects with fake variables
22
    local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent()}
23
    local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
24
    local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
25
        CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
26
    end}
27
    --Merged 2 functions into one by checking amount of arguments
28
    CAS.UnbindAction = CAS.BindAction
29
 
30
    --This function will trigger the events that have been :Connect()'ed
31
    local function te(self,ev,...)
32
        local t = m[ev]
33
        if t and t._fakeEvent and t.Function then
34
            t.Function(...)
35
        end
36
    end
37
    m.TrigEvent = te
38
    UIS.TrigEvent = te
39
 
40
    Event.OnServerEvent:Connect(function(plr,io)
41
        if plr~=Player then return end
42
        if io.isMouse then
43
            m.Target = io.Target
44
            m.Hit = io.Hit
45
        else
46
            local b = io.UserInputState == Enum.UserInputState.Begin
47
            if io.UserInputType == Enum.UserInputType.MouseButton1 then
48
                return m:TrigEvent(b and "Button1Down" or "Button1Up")
49
            end
50
            for _,t in pairs(CAS.Actions) do
51
                for _,k in pairs(t.Keys) do
52
                    if k==io.KeyCode then
53
                        t.Function(t.Name,io.UserInputState,io)
54
                    end
55
                end
56
            end
57
            m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
58
            UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false)
59
        end
60
    end)
61
    Event.Parent = NLS([==[
62
    local Player = game:GetService("Players").LocalPlayer
63
    local Event = script:WaitForChild("UserInput_Event")
64
 
65
    local UIS = game:GetService("UserInputService")
66
    local input = function(io,a)
67
        if a then return end
68
        --Since InputObject is a client-side instance, we create and pass table instead
69
        Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState})
70
    end
71
    UIS.InputBegan:Connect(input)
72
    UIS.InputEnded:Connect(input)
73
 
74
    local Mouse = Player:GetMouse()
75
    local h,t
76
    --Give the server mouse data 30 times every second, but only if the values changed
77
    --If player is not moving their mouse, client won't fire events
78
    while wait(1/30) do
79
        if h~=Mouse.Hit or t~=Mouse.Target then
80
            h,t=Mouse.Hit,Mouse.Target
81
            Event:FireServer({isMouse=true,Target=t,Hit=h})
82
        end
83
    end]==],Player.Character)
84
    Mouse,mouse,UserInputService,ContextActionService = m,m,UIS,CAS
85
end
86
87
88
89
90
local Gui = Instance.new("ScreenGui")
91
local grab = Instance.new("TextButton")
92
local nuke = Instance.new("TextButton")
93
local coming = Instance.new("TextButton")
94
95
Gui.Name = "MainGui"
96
97
Gui.Parent = game.Players.LocalPlayer.PlayerGui
98
99
100
grab.Name = "grab"
101
grab.Parent = Gui
102
grab.BackgroundColor3 = Color3.new(1, 1, 1)
103
grab.Position = UDim2.new(0, 0, 0.450199217, 0)
104
grab.Size = UDim2.new(0, 200, 0, 50)
105
grab.Font = Enum.Font.SourceSans
106
grab.Text = "minecraft"
107
grab.TextColor3 = Color3.new(0, 0, 0)
108
grab.TextSize = 14
109
110
nuke.Name = "nuke"
111
nuke.Parent = Gui
112
nuke.BackgroundColor3 = Color3.new(1, 1, 1)
113
nuke.Position = UDim2.new(0, 0, 0.549800813, 0)
114
nuke.Size = UDim2.new(0, 200, 0, 50)
115
nuke.Font = Enum.Font.SourceSans
116
nuke.Text = "nuke"
117
nuke.TextColor3 = Color3.new(0, 0, 0)
118
nuke.TextSize = 14
119
120
grab.MouseButton1Down:Connect(function()
121
--[[
122
	
123
	
124
	
125
   ▓▒▒▓▓  ░▓▒▒██▒▒▓█▒▒▓▓ █▒▒▓█▒▒▒▒▒▒▒█▓▒▒▒▒▒▒▒█▒▓▒▒▒▒▒▓█▒▒▒▒▒▒▒█▓▒▒▒▓▒▒▓█▒▒▒▒▒▓▒▓░
126
   ▓  ░█▒ ▓░  ▓▓  ░█  ░█░▒  ▒▒       █░       █ ░     ▒▓       ▓▒       █       ░░
127
  ░░ ░ ▒██░░░ █░  ▓▓  ░░█░  ▓▒  ▒█████░  ▓█████░░ ▓▓  ░█ ▒█░█▓ ▒▓  ░███████▓   ██░
128
  ▓    ▓█▓  ▒▒█   █▒   ░█   ▓▒  ▒█████░  ▓█████░░ ▓▓  ░█  ▒█▓░ ░▓   ▓███████   █▓ 
129
  ▓    ░░    ▒█   █▒    ░   █░   ░░░░█░  ▓█████░     ▒██░ ▒██▒ ░█     ░ ░███   ▒░ 
130
 ▒░  ░░      ▓▓   █░  ▓▒    █░   ░░ ░█░  ▓█████░       █░ ░░ ░  █░     ░ ███░  ░▒ 
131
 ▒░  ▓▓ ▒▓   █░  ▒█   █▒ ░  █   ▓█████░  ▓    █░  ▒▓   █▒   ░   █▒  ▒█▓█████▓  ░▒ 
132
 ▒░▒░█▒▒█▓   █░  ▓█   ██░ ░ █░  ▓█████░  ▓█████░  ▒█ ░ █▒  ▒█ ░ █▒  ░███▓███▓░  ▒ 
133
░▒░ ▒█▓ ▒▒  ▒█░  ▓▓  ░██   ░▓ ▒    ░ █░       █░  ▒█   ▓▒  ░█   ▒▓   ███ ▓███░  ▒░
134
▒░ ░▓██▒░░  ▓▓   █▒  ▒██   ▓▓ ░   ░ ░█░     ░ █░  ▒█   ▓▓   █░  ▒█   █▓░ ░███▒  ░▒
135
▒▒  ▒███░▒  ░█   █▓  ░██░  ▒█ ░      █░     ░ █░  ▒█   █▒  ░█   ▓▓  ░█   ░██▓▒  ▓░
136
 ▒▒  ▒██▓▓▒  ▒▓   █░  ▓█▓   █░      ▒█░       █░  ▓▓  ░█░  ▓▒  ░█▒  ▓     ▓█▒░ ▒▒ 
137
  ▒▒░ █▓  ▓▒░▒█▒░░▓█░░▒█▒▒░░▓▓░▒▒▒░░▒█▒░░░░░░░█▒░▒█▓░░▓█▒░▒█░░░█▓░░▓▒     ▓█░░▒▒  
138
   ░▒▒▒░   ▒░░▒▒░░░░░░░░ ▒░░░▒▒▒▒▒▒▒▒░░░░░░░░░░░░░▒▒▒▒▒▒▒▒▒▒░▒▒▒░░░░      ░░░▒░   
139
                           ASCII Art Generators are cool :)
140
141
142
143
]]
144
145
-- Scroll down for changelog...
146
147
-- ORIGINAL CREATOR: Depr1
148
149
-- If this script isn't on pastebin or the user who uploaded this isn't called "Delros12"
150
-- (and yes my pastebin account is Delros12) or the link is not https://pastebin.com/2NNDTLjL
151
-- then this is not the original link of this script. 
152
153
-- The original link of the script gets edited constantly for updates, if you use the original
154
-- link you will be able to enjoy the most recent updates of this script without changing to 
155
-- another link which contains updated script.
156
157
-- Controls: Q to sneak, use the keypad numbers 1-9 to change blocks, 
158
-- choose a empty slot if you want to remove a block, E to open creative
159
-- inventory, right-click to destroy a block in your toolbar in creative
160
-- inventory.
161
162
-- You will become steve when you use this script, if you die after 
163
-- using this script, keep trying to use it or wait 60 seconds 
164
-- (it doesn't work at first but eventually it will)
165
166
-- Enjoy! :)
167
168
local updateHand = false
169
local Changelog = [[
170
171
   04/02/2018:
172
   + Added creative inventory.
173
   + Added 31 blocks (that's a lot, but not near minecraft's level).
174
   + Fixed a bug where the hand dissapears if u look down while sneaking.
175
   + Fixed? (not sure) a bug where if u ran the script you would die.
176
   + Added sprinting (i'll add footsteps and particles later).
177
   - Removed herobrine
178
179
   01/02/2018:
180
   + Added the hand that appears on minecraft when ur first person.
181
   + Added a walking animation to the hand.
182
   + Punching animation added to the hand.
183
   + Camera bobbing.
184
   + Sneaking now lowers your camera just like in minecraft.
185
   + Blocks now have sounds (i chose the ones that are the closest to minecraft sounds).
186
   + When a block is broken, particles will fall from it.
187
188
]]
189
190
local RS = game:GetService("RunService").RenderStepped
191
local targetName = game.Players.LocalPlayer.Name
192
local player = game.Players:FindFirstChild(targetName)
193
local creativeInventory = {
194
	{
195
		name = "Dirt",
196
		size = Vector3.new(2.6, 2.6, 2.6),
197
		transparency = 0;
198
		frontTex = "rbxassetid://152569532",
199
		backTex = "rbxassetid://152569532",
200
		topTex = "rbxassetid://152569532",
201
		bottomTex = "rbxassetid://152569532",
202
		leftTex = "rbxassetid://152569532",
203
		rightTex = "rbxassetid://152569532",
204
		sound = "rbxassetid://1102186681",
205
		soundVol = 1.25,
206
		hasGravity = false
207
	},
208
	{
209
		name = "Grass",
210
		size = Vector3.new(2.6, 2.6, 2.6),
211
		transparency = 0;
212
		frontTex = "rbxassetid://96430337",
213
		backTex = "rbxassetid://96430337",
214
		topTex = "rbxassetid://96430265",
215
		bottomTex = "rbxassetid://179655033",
216
		leftTex = "rbxassetid://96430337",
217
		rightTex = "rbxassetid://96430337",
218
		sound = "rbxassetid://1102186681",
219
		soundVol = 1.25,
220
		hasGravity = false
221
	},
222
	{
223
		name = "Sand",
224
		size = Vector3.new(2.6, 2.6, 2.6),
225
		transparency = 0;
226
		frontTex = "rbxassetid://347007448",
227
		backTex = "rbxassetid://347007448",
228
		topTex = "rbxassetid://347007448",
229
		bottomTex = "rbxassetid://347007448",
230
		leftTex = "rbxassetid://347007448",
231
		rightTex = "rbxassetid://347007448",
232
		sound = "rbxassetid://1102186681",
233
		soundVol = 1.25,
234
		hasGravity = true
235
	},
236
	{
237
		name = "Gravel",
238
		size = Vector3.new(2.6, 2.6, 2.6),
239
		transparency = 0;
240
		frontTex = "rbxassetid://151701568",
241
		backTex = "rbxassetid://151701568",
242
		topTex = "rbxassetid://151701568",
243
		bottomTex = "rbxassetid://151701568",
244
		leftTex = "rbxassetid://151701568",
245
		rightTex = "rbxassetid://151701568",
246
		sound = "rbxassetid://1102186681",
247
		soundVol = 1.25,
248
		hasGravity = true
249
	},
250
	{
251
		name = "Stone",
252
		size = Vector3.new(2.6, 2.6, 2.6),
253
		transparency = 0;
254
		frontTex = "rbxassetid://75880927",
255
		backTex = "rbxassetid://75880927",
256
		topTex = "rbxassetid://75880927",
257
		bottomTex = "rbxassetid://75880927",
258
		leftTex = "rbxassetid://75880927",
259
		rightTex = "rbxassetid://75880927",
260
		sound = "rbxassetid://1016978163",
261
		soundVol = 2,
262
		hasGravity = false
263
	},
264
	{
265
		name = "Diamond Ore",
266
		size = Vector3.new(2.6, 2.6, 2.6),
267
		transparency = 0;
268
		frontTex = "rbxassetid://57928490",
269
		backTex = "rbxassetid://57928490",
270
		topTex = "rbxassetid://57928490",
271
		bottomTex = "rbxassetid://57928490",
272
		leftTex = "rbxassetid://57928490",
273
		rightTex = "rbxassetid://57928490",
274
		sound = "rbxassetid://1016978163",
275
		soundVol = 2,
276
		hasGravity = false
277
	},
278
	{
279
		name = "Diamond Block",
280
		size = Vector3.new(2.6, 2.6, 2.6),
281
		transparency = 0;
282
		frontTex = "rbxassetid://56749955",
283
		backTex = "rbxassetid://56749955",
284
		topTex = "rbxassetid://56749955",
285
		bottomTex = "rbxassetid://56749955",
286
		leftTex = "rbxassetid://56749955",
287
		rightTex = "rbxassetid://56749955",
288
		sound = "rbxassetid://1016978163",
289
		soundVol = 2,
290
		hasGravity = false
291
	},
292
{
293
		name = "Emerald Block",
294
		size = Vector3.new(2.6, 2.6, 2.6),
295
		transparency = 0;
296
		frontTex = "rbxassetid://152410853",
297
		backTex = "rbxassetid://152410853",
298
		topTex = "rbxassetid://152410853",
299
		bottomTex = "rbxassetid://152410853",
300
		leftTex = "rbxassetid://152410853",
301
		rightTex = "rbxassetid://152410853",
302
		sound = "rbxassetid://1016978163",
303
		soundVol = 2,
304
		hasGravity = false
305
	},
306
	{
307
		name = "Emerald Ore",
308
		size = Vector3.new(2.6, 2.6, 2.6),
309
		transparency = 0;
310
		frontTex = "rbxassetid://152410868",
311
		backTex = "rbxassetid://152410868",
312
		topTex = "rbxassetid://152410868",
313
		bottomTex = "rbxassetid://152410868",
314
		leftTex = "rbxassetid://152410868",
315
		rightTex = "rbxassetid://152410868",
316
		sound = "rbxassetid://1016978163",
317
		soundVol = 2,
318
		hasGravity = false
319
	},
320
	{
321
		name = "Obsidian",
322
		size = Vector3.new(2.6, 2.6, 2.6),
323
		transparency = 0;
324
		frontTex = "rbxassetid://112560322",
325
		backTex = "rbxassetid://112560322",
326
		topTex = "rbxassetid://112560322",
327
		bottomTex = "rbxassetid://112560322",
328
		leftTex = "rbxassetid://112560322",
329
		rightTex = "rbxassetid://112560322",
330
		sound = "rbxassetid://1016978163",
331
		soundVol = 2,
332
		hasGravity = false
333
	},
334
	{
335
		name = "Gold Block",
336
		size = Vector3.new(2.6, 2.6, 2.6),
337
		transparency = 0;
338
		frontTex = "rbxassetid://152572128",
339
		backTex = "rbxassetid://152572128",
340
		topTex = "rbxassetid://152572128",
341
		bottomTex = "rbxassetid://152572128",
342
		leftTex = "rbxassetid://152572128",
343
		rightTex = "rbxassetid://152572128",
344
		sound = "rbxassetid://1016978163",
345
		soundVol = 2,
346
		hasGravity = false
347
	},
348
	{
349
		name = "Gold Ore",
350
		size = Vector3.new(2.6, 2.6, 2.6),
351
		transparency = 0;
352
		frontTex = "rbxassetid://152572121",
353
		backTex = "rbxassetid://152572121",
354
		topTex = "rbxassetid://152572121",
355
		bottomTex = "rbxassetid://152572121",
356
		leftTex = "rbxassetid://152572121",
357
		rightTex = "rbxassetid://152572121",
358
		sound = "rbxassetid://1016978163",
359
		soundVol = 2,
360
		hasGravity = false
361
	},
362
	{
363
		name = "Iron Block",
364
		size = Vector3.new(2.6, 2.6, 2.6),
365
		transparency = 0;
366
		frontTex = "rbxassetid://152572134",
367
		backTex = "rbxassetid://152572134",
368
		topTex = "rbxassetid://152572134",
369
		bottomTex = "rbxassetid://152572134",
370
		leftTex = "rbxassetid://152572134",
371
		rightTex = "rbxassetid://152572134",
372
		sound = "rbxassetid://1016978163",
373
		soundVol = 2,
374
		hasGravity = false
375
	},
376
	{
377
		name = "Iron Ore",
378
		size = Vector3.new(2.6, 2.6, 2.6),
379
		transparency = 0;
380
		frontTex = "rbxassetid://132879562",
381
		backTex = "rbxassetid://132879562",
382
		topTex = "rbxassetid://132879562",
383
		bottomTex = "rbxassetid://132879562",
384
		leftTex = "rbxassetid://132879562",
385
		rightTex = "rbxassetid://132879562",
386
		sound = "rbxassetid://1016978163",
387
		soundVol = 2,
388
		hasGravity = false
389
	},
390
	{
391
		name = "Redstone Block",
392
		size = Vector3.new(2.6, 2.6, 2.6),
393
		transparency = 0;
394
		frontTex = "rbxassetid://136260219",
395
		backTex = "rbxassetid://136260219",
396
		topTex = "rbxassetid://136260219",
397
		bottomTex = "rbxassetid://136260219",
398
		leftTex = "rbxassetid://136260219",
399
		rightTex = "rbxassetid://136260219",
400
		sound = "rbxassetid://1016978163",
401
		soundVol = 2,
402
		hasGravity = false
403
	},
404
	{
405
		name = "Redstone Ore",
406
		size = Vector3.new(2.6, 2.6, 2.6),
407
		transparency = 0;
408
		frontTex = "rbxassetid://152572209",
409
		backTex = "rbxassetid://152572209",
410
		topTex = "rbxassetid://152572209",
411
		bottomTex = "rbxassetid://152572209",
412
		leftTex = "rbxassetid://152572209",
413
		rightTex = "rbxassetid://152572209",
414
		sound = "rbxassetid://1016978163",
415
		soundVol = 2,
416
		hasGravity = false
417
	},
418
	{
419
		name = "Coal Block",
420
		size = Vector3.new(2.6, 2.6, 2.6),
421
		transparency = 0;
422
		frontTex = "rbxassetid://152527418",
423
		backTex = "rbxassetid://152527418",
424
		topTex = "rbxassetid://152527418",
425
		bottomTex = "rbxassetid://152527418",
426
		leftTex = "rbxassetid://152527418",
427
		rightTex = "rbxassetid://152527418",
428
		sound = "rbxassetid://1016978163",
429
		soundVol = 2,
430
		hasGravity = false
431
	},
432
	{
433
		name = "Coal Ore",
434
		size = Vector3.new(2.6, 2.6, 2.6),
435
		transparency = 0;
436
		frontTex = "rbxassetid://152572101",
437
		backTex = "rbxassetid://152572101",
438
		topTex = "rbxassetid://152572101",
439
		bottomTex = "rbxassetid://152572101",
440
		leftTex = "rbxassetid://152572101",
441
		rightTex = "rbxassetid://152572101",
442
		sound = "rbxassetid://1016978163",
443
		soundVol = 2,
444
		hasGravity = false
445
	},
446
	{
447
		name = "Bedrock",
448
		size = Vector3.new(2.6, 2.6, 2.6),
449
		transparency = 0;
450
		frontTex = "rbxassetid://75881126",
451
		backTex = "rbxassetid://75881126",
452
		topTex = "rbxassetid://75881126",
453
		bottomTex = "rbxassetid://75881126",
454
		leftTex = "rbxassetid://75881126",
455
		rightTex = "rbxassetid://75881126",
456
		sound = "rbxassetid://1016978163",
457
		soundVol = 2,
458
		hasGravity = false
459
	},
460
	{
461
		name = "Cobblestone",
462
		size = Vector3.new(2.6, 2.6, 2.6),
463
		transparency = 0;
464
		frontTex = "rbxassetid://152572105",
465
		backTex = "rbxassetid://152572105",
466
		topTex = "rbxassetid://152572105",
467
		bottomTex = "rbxassetid://152572105",
468
		leftTex = "rbxassetid://152572105",
469
		rightTex = "rbxassetid://152572105",
470
		sound = "rbxassetid://1016978163",
471
		soundVol = 2,
472
		hasGravity = false
473
	},
474
	{		
475
		name = "Mossy Stone Brick",
476
		size = Vector3.new(2.6, 2.6, 2.6),
477
		transparency = 0;
478
		frontTex = "rbxassetid://61826751",
479
		backTex = "rbxassetid://61826751",
480
		topTex = "rbxassetid://61826751",
481
		bottomTex = "rbxassetid://61826751",
482
		leftTex = "rbxassetid://61826751",
483
		rightTex = "rbxassetid://61826751",
484
		sound = "rbxassetid://1016978163",
485
		soundVol = 2,
486
		hasGravity = false
487
	},
488
	{		
489
		name = "Cracked Stone Brick",
490
		size = Vector3.new(2.6, 2.6, 2.6),
491
		transparency = 0;
492
		frontTex = "rbxassetid://151802087",
493
		backTex = "rbxassetid://151802087",
494
		topTex = "rbxassetid://151802087",
495
		bottomTex = "rbxassetid://151802087",
496
		leftTex = "rbxassetid://151802087",
497
		rightTex = "rbxassetid://151802087",
498
		sound = "rbxassetid://1016978163",
499
		soundVol = 2,
500
		hasGravity = false
501
	},
502
	{		
503
		name = "Chiseled Stone Brick",
504
		size = Vector3.new(2.6, 2.6, 2.6),
505
		transparency = 0;
506
		frontTex = "rbxassetid://151802074",
507
		backTex = "rbxassetid://151802074",
508
		topTex = "rbxassetid://151802074",
509
		bottomTex = "rbxassetid://151802074",
510
		leftTex = "rbxassetid://151802074",
511
		rightTex = "rbxassetid://151802074",
512
		sound = "rbxassetid://1016978163",
513
		soundVol = 2,
514
		hasGravity = false
515
	},
516
	{		
517
		name = "Stone Brick",
518
		size = Vector3.new(2.6, 2.6, 2.6),
519
		transparency = 0;
520
		frontTex = "rbxassetid://61826773",
521
		backTex = "rbxassetid://61826773",
522
		topTex = "rbxassetid://61826773",
523
		bottomTex = "rbxassetid://61826773",
524
		leftTex = "rbxassetid://61826773",
525
		rightTex = "rbxassetid://61826773",
526
		sound = "rbxassetid://1016978163",
527
		soundVol = 2,
528
		hasGravity = false
529
	},
530
	{		
531
		name = "Nether Brick",
532
		size = Vector3.new(2.6, 2.6, 2.6),
533
		transparency = 0;
534
		frontTex = "rbxassetid://151802104",
535
		backTex = "rbxassetid://151802104",
536
		topTex = "rbxassetid://151802104",
537
		bottomTex = "rbxassetid://151802104",
538
		leftTex = "rbxassetid://151802104",
539
		rightTex = "rbxassetid://151802104",
540
		sound = "rbxassetid://1016978163",
541
		soundVol = 2,
542
		hasGravity = false
543
	},
544
	{		
545
		name = "Granite",
546
		size = Vector3.new(2.6, 2.6, 2.6),
547
		transparency = 0;
548
		frontTex = "rbxassetid://151776467",
549
		backTex = "rbxassetid://151776467",
550
		topTex = "rbxassetid://151776467",
551
		bottomTex = "rbxassetid://151776467",
552
		leftTex = "rbxassetid://151776467",
553
		rightTex = "rbxassetid://151776467",
554
		sound = "rbxassetid://1016978163",
555
		soundVol = 2,
556
		hasGravity = false
557
	},
558
	{		
559
		name = "Diorite",
560
		size = Vector3.new(2.6, 2.6, 2.6),
561
		transparency = 0;
562
		frontTex = "rbxassetid://151776452",
563
		backTex = "rbxassetid://151776452",
564
		topTex = "rbxassetid://151776452",
565
		bottomTex = "rbxassetid://151776452",
566
		leftTex = "rbxassetid://151776452",
567
		rightTex = "rbxassetid://151776452",
568
		sound = "rbxassetid://1016978163",
569
		soundVol = 2,
570
		hasGravity = false
571
	},
572
	{		
573
		name = "Andesite",
574
		size = Vector3.new(2.6, 2.6, 2.6),
575
		transparency = 0;
576
		frontTex = "rbxassetid://151776422",
577
		backTex = "rbxassetid://151776422",
578
		topTex = "rbxassetid://151776422",
579
		bottomTex = "rbxassetid://151776422",
580
		leftTex = "rbxassetid://151776422",
581
		rightTex = "rbxassetid://151776422",
582
		sound = "rbxassetid://1016978163",
583
		soundVol = 2,
584
		hasGravity = false
585
	},
586
	{		
587
		name = "Polished Granite",
588
		size = Vector3.new(2.6, 2.6, 2.6),
589
		transparency = 0;
590
		frontTex = "rbxassetid://151776506",
591
		backTex = "rbxassetid://151776506",
592
		topTex = "rbxassetid://151776506",
593
		bottomTex = "rbxassetid://151776506",
594
		leftTex = "rbxassetid://151776506",
595
		rightTex = "rbxassetid://151776506",
596
		sound = "rbxassetid://1016978163",
597
		soundVol = 2,
598
		hasGravity = false
599
	},
600
	{		
601
		name = "Polished Diorite",
602
		size = Vector3.new(2.6, 2.6, 2.6),
603
		transparency = 0;
604
		frontTex = "rbxassetid://151776533",
605
		backTex = "rbxassetid://151776533",
606
		topTex = "rbxassetid://151776533",
607
		bottomTex = "rbxassetid://151776533",
608
		leftTex = "rbxassetid://151776533",
609
		rightTex = "rbxassetid://151776533",
610
		sound = "rbxassetid://1016978163",
611
		soundVol = 2,
612
		hasGravity = false
613
	},
614
	{		
615
		name = "Polished Andesite",
616
		size = Vector3.new(2.6, 2.6, 2.6),
617
		transparency = 0;
618
		frontTex = "rbxassetid://151776506",
619
		backTex = "rbxassetid://151776506",
620
		topTex = "rbxassetid://151776506",
621
		bottomTex = "rbxassetid://151776506",
622
		leftTex = "rbxassetid://151776506",
623
		rightTex = "rbxassetid://151776506",
624
		sound = "rbxassetid://1016978163",
625
		soundVol = 2,
626
		hasGravity = false
627
	},
628
	{
629
		name = "Brick Block",
630
		size = Vector3.new(2.6, 2.6, 2.6),
631
		transparency = 0;
632
		frontTex = "rbxassetid://59389191",
633
		backTex = "rbxassetid://59389191",
634
		topTex = "rbxassetid://59389191",
635
		bottomTex = "rbxassetid://59389191",
636
		leftTex = "rbxassetid://59389191",
637
		rightTex = "rbxassetid://59389191",
638
		sound = "rbxassetid://1016978163",
639
		soundVol = 2,
640
		hasGravity = false
641
	},
642
	{
643
		name = "Packed Ice",
644
		size = Vector3.new(2.6, 2.6, 2.6),
645
		transparency = 0;
646
		frontTex = "rbxassetid://152528023",
647
		backTex = "rbxassetid://152528023",
648
		topTex = "rbxassetid://152528023",
649
		bottomTex = "rbxassetid://152528023",
650
		leftTex = "rbxassetid://152528023",
651
		rightTex = "rbxassetid://152528023",
652
		sound = "rbxassetid://1016978163",
653
		soundVol = 2,
654
		hasGravity = false
655
	},
656
	{
657
		name = "Ice Block",
658
		size = Vector3.new(2.6, 2.6, 2.6),
659
		transparency = 1;
660
		frontTex = "rbxassetid://118555586",
661
		backTex = "rbxassetid://118555586",
662
		topTex = "rbxassetid://118555586",
663
		bottomTex = "rbxassetid://118555586",
664
		leftTex = "rbxassetid://118555586",
665
		rightTex = "rbxassetid://118555586",
666
		sound = "rbxassetid://1016978163",
667
		soundVol = 2,
668
		hasGravity = false
669
	},
670
	{
671
		name = "Netherrack",
672
		size = Vector3.new(2.6, 2.6, 2.6),
673
		transparency = 0;
674
		frontTex = "rbxassetid://151802119",
675
		backTex = "rbxassetid://151802119",
676
		topTex = "rbxassetid://151802119",
677
		bottomTex = "rbxassetid://151802119",
678
		leftTex = "rbxassetid://151802119",
679
		rightTex = "rbxassetid://151802119",
680
		sound = "rbxassetid://1016978163",
681
		soundVol = 2,
682
		hasGravity = false
683
	},
684
	{
685
		name = "End Stone",
686
		size = Vector3.new(2.6, 2.6, 2.6),
687
		transparency = 0;
688
		frontTex = "rbxassetid://151802091",
689
		backTex = "rbxassetid://151802091",
690
		topTex = "rbxassetid://151802091",
691
		bottomTex = "rbxassetid://151802091",
692
		leftTex = "rbxassetid://151802091",
693
		rightTex = "rbxassetid://151802091",
694
		sound = "rbxassetid://1016978163",
695
		soundVol = 2,
696
		hasGravity = false
697
	},
698
	{
699
		name = "Glass Block",
700
		size = Vector3.new(2.6, 2.6, 2.6),
701
		transparency = 1;
702
		frontTex = "rbxassetid://152239003",
703
		backTex = "rbxassetid://152239003",
704
		topTex = "rbxassetid://152239003",
705
		bottomTex = "rbxassetid://152239003",
706
		leftTex = "rbxassetid://152239003",
707
		rightTex = "rbxassetid://152239003",
708
		sound = "rbxassetid://1016978163",
709
		soundVol = 2,
710
		hasGravity = false
711
	},
712
	{
713
		name = "Glowstone",
714
		size = Vector3.new(2.6, 2.6, 2.6),
715
		transparency = 0;
716
		frontTex = "rbxassetid://54790811",
717
		backTex = "rbxassetid://54790811",
718
		topTex = "rbxassetid://54790811",
719
		bottomTex = "rbxassetid://54790811",
720
		leftTex = "rbxassetid://54790811",
721
		rightTex = "rbxassetid://54790811",
722
		sound = "rbxassetid://1016978163",
723
		soundVol = 2,
724
		hasGravity = false
725
	},
726
	{
727
		name = "Bookshelf",
728
		size = Vector3.new(2.6, 2.6, 2.6),
729
		transparency = 0;
730
		frontTex = "rbxassetid://118554092",
731
		backTex = "rbxassetid://118554092",
732
		topTex = "rbxassetid://346201871",
733
		bottomTex = "rbxassetid://346201871",
734
		leftTex = "rbxassetid://118554092",
735
		rightTex = "rbxassetid://118554092",
736
		sound = "rbxassetid://507863457",
737
		soundVol = 2,
738
		hasGravity = false
739
	},
740
	{
741
		name = "Oak Wood Planks",
742
		size = Vector3.new(2.6, 2.6, 2.6),
743
		transparency = 0;
744
		frontTex = "rbxassetid://346201871",
745
		backTex = "rbxassetid://346201871",
746
		topTex = "rbxassetid://346201871",
747
		bottomTex = "rbxassetid://346201871",
748
		leftTex = "rbxassetid://346201871",
749
		rightTex = "rbxassetid://346201871",
750
		sound = "rbxassetid://507863457",
751
		soundVol = 2,
752
		hasGravity = false
753
	},
754
	{
755
		name = "Oak Log",
756
		size = Vector3.new(2.6, 2.6, 2.6),
757
		transparency = 0;
758
		frontTex = "rbxassetid://71445924",
759
		backTex = "rbxassetid://71445924",
760
		topTex = "rbxassetid://152538557",
761
		bottomTex = "rbxassetid://152538557",
762
		leftTex = "rbxassetid://71445924",
763
		rightTex = "rbxassetid://71445924",
764
		sound = "rbxassetid://507863457",
765
		soundVol = 2,
766
		hasGravity = false
767
	},
768
	{
769
		name = "Oak Leaves",
770
		size = Vector3.new(2.6, 2.6, 2.6),
771
		transparency = 1;
772
		frontTex = "rbxassetid://151708391",
773
		backTex = "rbxassetid://151708391",
774
		topTex = "rbxassetid://151708391",
775
		bottomTex = "rbxassetid://151708391",
776
		leftTex = "rbxassetid://151708391",
777
		rightTex = "rbxassetid://151708391",
778
		sound = "rbxassetid://507863457", 
779
		-- couldn't find a leaves sound for this one, sorry lol
780
		soundVol = 2,
781
		hasGravity = false
782
	}
783
}
784
local toolBar = {
785
	{
786
		name = "Dirt Block",
787
		size = Vector3.new(2.6, 2.6, 2.6),
788
		transparency = 0;
789
		frontTex = "rbxassetid://152569532",
790
		backTex = "rbxassetid://152569532",
791
		topTex = "rbxassetid://152569532",
792
		bottomTex = "rbxassetid://152569532",
793
		leftTex = "rbxassetid://152569532",
794
		rightTex = "rbxassetid://152569532",
795
		sound = "rbxassetid://1102186681",
796
		soundVol = 1.25,
797
		hasGravity = false
798
	},
799
	{
800
		name = "Grass Block",
801
		size = Vector3.new(2.6, 2.6, 2.6),
802
		transparency = 0;
803
		frontTex = "rbxassetid://96430337",
804
		backTex = "rbxassetid://96430337",
805
		topTex = "rbxassetid://96430265",
806
		bottomTex = "rbxassetid://179655033",
807
		leftTex = "rbxassetid://96430337",
808
		rightTex = "rbxassetid://96430337",
809
		sound = "rbxassetid://1102186681",
810
		soundVol = 1.25,
811
		hasGravity = false
812
	},
813
	{
814
		name = "Stone",
815
		size = Vector3.new(2.6, 2.6, 2.6),
816
		transparency = 0;
817
		frontTex = "rbxassetid://75880927",
818
		backTex = "rbxassetid://75880927",
819
		topTex = "rbxassetid://75880927",
820
		bottomTex = "rbxassetid://75880927",
821
		leftTex = "rbxassetid://75880927",
822
		rightTex = "rbxassetid://75880927",
823
		sound = "rbxassetid://1016978163",
824
		soundVol = 2,
825
		hasGravity = false
826
	},
827
	{
828
		name = "Diamond Ore",
829
		size = Vector3.new(2.6, 2.6, 2.6),
830
		transparency = 0;
831
		frontTex = "rbxassetid://57928490",
832
		backTex = "rbxassetid://57928490",
833
		topTex = "rbxassetid://57928490",
834
		bottomTex = "rbxassetid://57928490",
835
		leftTex = "rbxassetid://57928490",
836
		rightTex = "rbxassetid://57928490",
837
		sound = "rbxassetid://1016978163",
838
		soundVol = 2,
839
		hasGravity = false
840
	},
841
	{
842
		name = "Diamond Block",
843
		size = Vector3.new(2.6, 2.6, 2.6),
844
		transparency = 0;
845
		frontTex = "rbxassetid://56749955",
846
		backTex = "rbxassetid://56749955",
847
		topTex = "rbxassetid://56749955",
848
		bottomTex = "rbxassetid://56749955",
849
		leftTex = "rbxassetid://56749955",
850
		rightTex = "rbxassetid://56749955",
851
		sound = "rbxassetid://1016978163",
852
		soundVol = 2,
853
		hasGravity = false
854
	},
855
	{
856
		name = "Oak Wood Planks",
857
		size = Vector3.new(2.6, 2.6, 2.6),
858
		transparency = 0;
859
		frontTex = "rbxassetid://346201871",
860
		backTex = "rbxassetid://346201871",
861
		topTex = "rbxassetid://346201871",
862
		bottomTex = "rbxassetid://346201871",
863
		leftTex = "rbxassetid://346201871",
864
		rightTex = "rbxassetid://346201871",
865
		sound = "rbxassetid://507863457",
866
		soundVol = 2,
867
		hasGravity = false
868
	},
869
	{
870
		name = "Oak Log",
871
		size = Vector3.new(2.6, 2.6, 2.6),
872
		transparency = 0;
873
		frontTex = "rbxassetid://71445924",
874
		backTex = "rbxassetid://71445924",
875
		topTex = "rbxassetid://152538557",
876
		bottomTex = "rbxassetid://152538557",
877
		leftTex = "rbxassetid://71445924",
878
		rightTex = "rbxassetid://71445924",
879
		sound = "rbxassetid://507863457",
880
		soundVol = 2,
881
		hasGravity = false
882
	}
883
}
884
function putTexture(part, frontF, backF, topF, bottomF, leftF, rightF, className)
885
	local faces = {"Front", "Back", "Top", "Bottom", "Left", "Right"}
886
	for i,f in pairs(faces) do
887
		local decal = Instance.new(className, part)
888
		if i == 1 then decal.Texture = frontF decal.Name = f end
889
		if i == 2 then decal.Texture = backF or frontF decal.Name = f  end
890
		if i == 3 then decal.Texture = topF or frontF decal.Name = f  end
891
		if i == 4 then decal.Texture = bottomF or frontF decal.Name = f end
892
		if i == 5 then decal.Texture = leftF or frontF decal.Name = f  end
893
		if i == 6 then decal.Texture = rightF or frontF decal.Name = f  end
894
		decal.Face = f
895
	end
896
	return part
897
end
898
function makeSquare(position, size, color, transparency, parent, zindex)
899
	local label = Instance.new("TextLabel", parent)
900
	label.Text = ""
901
	label.BorderSizePixel = 0
902
	label.BackgroundTransparency = transparency
903
	label.Position = position
904
	label.Size = size
905
	label.BackgroundColor3 = color
906
	if zindex == nil then label.ZIndex = 1 else label.ZIndex = zindex end
907
	return label
908
end
909
function putInventorySlot(position, image, parent, zindex)
910
	local button = Instance.new("TextButton", parent)
911
	button.Position = position
912
	button.Size = UDim2.new(0, 36, 0, 36)
913
	button.BackgroundColor3 = Color3.new(139/255, 139/255, 139/255)
914
	button.Text = ""
915
	button.BorderSizePixel = 0
916
	button.ZIndex = zindex
917
	local imageLabel = Instance.new("ImageLabel", button)
918
	imageLabel.BackgroundTransparency = 0.9
919
	imageLabel.Position = UDim2.new(0, 2, 0, 2)
920
	imageLabel.Size = UDim2.new(0, 32, 0, 32)
921
	imageLabel.Image = image
922
	imageLabel.BorderSizePixel = 0
923
	imageLabel.ZIndex = zindex
924
	makeSquare(UDim2.new(0, 0, 0, 0), UDim2.new(0, 34, 0, 2),
925
		Color3.new(55/255, 55/255, 55/255), 0, button, zindex)
926
	makeSquare(UDim2.new(0, 0, 0, 0), UDim2.new(0, 2, 0, 34),
927
		Color3.new(55/255, 55/255, 55/255), 0, button, zindex)
928
	makeSquare(UDim2.new(0, 34, 0, 2), UDim2.new(0, 2, 0, 34),
929
		Color3.new(255/255, 255/255, 255/255), 0, button, zindex)
930
	makeSquare(UDim2.new(0, 2, 0, 34), UDim2.new(0, 34, 0, 2),
931
		Color3.new(255/255, 255/255, 255/255), 0, button, zindex)
932
	return button
933
end
934
935
local draggingBlock = nil
936
function makeInventory()
937
	local playerGui = player:FindFirstChild("PlayerGui")
938
	if playerGui then
939
		local invGui = Instance.new("ScreenGui", playerGui)
940
		local creativeInv = Instance.new("Frame", invGui)
941
		creativeInv.BackgroundTransparency = 1
942
		creativeInv.Position = UDim2.new(0.5, -170, 0.5, -202)
943
		
944
		creativeInv.Visible = false
945
		
946
		-- creative inventory GUI...
947
		
948
		local blackOut = makeSquare(UDim2.new(0, 0, 0, 0), UDim2.new(1, 0, 1, 0),
949
			Color3.new(0/255, 0/255, 0/255), 0.3, invGui, 1)
950
		blackOut.Visible = false
951
		
952
		creativeInv.Changed:connect(function()
953
			blackOut.Visible = creativeInv.Visible
954
		end)
955
		
956
		makeSquare(UDim2.new(0, -2, 0, 2), UDim2.new(0, 340, 0, 404),
957
			Color3.new(198/255, 198/255, 198/255), 0, creativeInv, 3)
958
		makeSquare(UDim2.new(0, 338, 0, 0), UDim2.new(0, 6, 0, 406),
959
			Color3.new(85/255, 85/255, 85/255), 0, creativeInv, 2)
960
		makeSquare(UDim2.new(0, 0, 0, 404), UDim2.new(0, 342, 0, 4),
961
			Color3.new(85/255, 85/255, 85/255), 0, creativeInv, 3)
962
		makeSquare(UDim2.new(0, 2, 0, 0), UDim2.new(0, 338, 0, 402),
963
			Color3.new(198/255, 198/255, 198/255), 0, creativeInv, 3)
964
		makeSquare(UDim2.new(0, -4, 0, -2), UDim2.new(0, 4, 0, 406),
965
			Color3.new(255/255, 255/255, 255/255), 0, creativeInv, 3)
966
		makeSquare(UDim2.new(0, -2, 0, -4), UDim2.new(0, 342, 0, 6),
967
			Color3.new(255/255, 255/255, 255/255), 0, creativeInv, 2)
968
		makeSquare(UDim2.new(0, 340, 0, -2), UDim2.new(0, 2, 0, 2),
969
			Color3.new(198/255, 198/255, 198/255), 0, creativeInv, 2)
970
		makeSquare(UDim2.new(0, 340, 0, -4), UDim2.new(0, 2, 0, 4),
971
			Color3.new(0/255, 0/255, 0/255), 0, creativeInv, 1)
972
		makeSquare(UDim2.new(0, 342, 0, -2), UDim2.new(0, 2, 0, 2),
973
			Color3.new(0/255, 0/255, 0/255), 0, creativeInv, 1)
974
		makeSquare(UDim2.new(0, 344, 0, 0), UDim2.new(0, 2, 0, 406),
975
			Color3.new(0/255, 0/255, 0/255), 0, creativeInv, 1)
976
		makeSquare(UDim2.new(0, -4, 0, -4), UDim2.new(0, 2, 0, 4),
977
			Color3.new(0/255, 0/255, 0/255), 0, creativeInv, 1)
978
		makeSquare(UDim2.new(0, -2, 0, -6), UDim2.new(0, 342, 0, 4),
979
			Color3.new(0/255, 0/255, 0/255), 0, creativeInv, 1)
980
		makeSquare(UDim2.new(0, 0, 0, 406), UDim2.new(0, 342, 0, 4),
981
			Color3.new(0/255, 0/255, 0/255), 0, creativeInv, 1)
982
		makeSquare(UDim2.new(0, 342, 0, 404), UDim2.new(0, 2, 0, 4),
983
			Color3.new(0/255, 0/255, 0/255), 0, creativeInv, 1)
984
		makeSquare(UDim2.new(0, -4, 0, 404), UDim2.new(0, 2, 0, 2),
985
			Color3.new(0/255, 0/255, 0/255), 0, creativeInv, 1)
986
		makeSquare(UDim2.new(0, -2, 0, 406), UDim2.new(0, 2, 0, 2),
987
			Color3.new(0/255, 0/255, 0/255), 0, creativeInv, 1)
988
		makeSquare(UDim2.new(0, -6, 0, -2), UDim2.new(0, 2, 0, 406),
989
			Color3.new(0/255, 0/255, 0/255), 0, creativeInv, 1)
990
		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)
991
		text.Text = "Creative Inventory"
992
		text.Font = "SourceSansSemibold"
993
		text.TextSize = 14
994
		text.TextXAlignment = "Left"
995
		--		
996
		local draggingBlockPicture = Instance.new("ImageLabel", invGui)
997
		draggingBlockPicture.BackgroundTransparency = 1
998
		draggingBlockPicture.Size = UDim2.new(0, 32, 0, 32)
999
		draggingBlockPicture.ZIndex = 5
1000
		coroutine.resume(coroutine.create(function()
1001
			local invMouse = player:GetMouse()
1002
			--local RS = game:GetService("RunService").RenderStepped	
1003
			invMouse.Button2Down:connect(function()
1004
				draggingBlock = nil
1005
			end)
1006
			while RS:wait() do
1007
				draggingBlockPicture.Position = UDim2.new(0, invMouse.X - 16, 0, invMouse.Y - 16)
1008
				if draggingBlock ~= nil then
1009
					draggingBlockPicture.Image = draggingBlock.frontTex
1010
				else
1011
					draggingBlockPicture.Image = ""
1012
				end
1013
			end
1014
		end))
1015
		
1016
		local done = false
1017
		local x = 0
1018
		local y = 0
1019
		
1020
		for i,b in pairs(creativeInventory) do
1021
			putInventorySlot(UDim2.new(0.5, (x*36) + 8, 0.5, (y*36) + 28), b.frontTex, creativeInv, 4).MouseButton1Down:connect(function()
1022
				if draggingBlock == nil then
1023
					draggingBlock = b
1024
				end
1025
			end)
1026
			x = x + 1
1027
			if x >= 8 then
1028
				x = 0
1029
				y = y + 1
1030
			end
1031
		end
1032
		if x == 0 then done = true end
1033
		while x < 8 and done == false do
1034
			putInventorySlot(UDim2.new(0.5, (x*36) + 8, 0.5, (y*36) + 28), "", creativeInv, 4)
1035
			x = x + 1
1036
		end
1037
		for i = 1, 9 do
1038
			if toolBar[i] ~= nil then
1039
				local invSlot = putInventorySlot(UDim2.new(0, 8 + ((i-1)*36), 0, 360), toolBar[i].frontTex, creativeInv, 4)
1040
				invSlot.MouseButton2Down:connect(function()
1041
					local imgLabel = invSlot:FindFirstChild("ImageLabel")
1042
					if imgLabel then
1043
						toolBar[i] = nil
1044
						imgLabel.Image = ""
1045
					end
1046
				end)
1047
				invSlot.MouseButton1Down:connect(function()
1048
					--updateHand = true
1049
					local imgLabel = invSlot:FindFirstChild("ImageLabel")
1050
					if toolBar[i] == nil then
1051
						toolBar[i] = draggingBlock
1052
						imgLabel.Image = draggingBlock.frontTex
1053
						draggingBlock = nil		
1054
						return				
1055
					end
1056
					if toolBar[i] ~= nil and draggingBlock == nil then
1057
						draggingBlock = toolBar[i]
1058
						toolBar[i] = nil
1059
						imgLabel.Image = ""
1060
						return
1061
					elseif toolBar[i] ~= nil and draggingBlock ~= nil then
1062
						--draggingBlock = toolBar[i]
1063
						--toolBar[i] = nil
1064
						imgLabel.Image = ""
1065
						local temp = toolBar[i]
1066
						toolBar[i] = draggingBlock
1067
						if imgLabel and draggingBlock ~= nil then 
1068
							imgLabel.Image = draggingBlock.frontTex
1069
						end 
1070
						if imgLabel and draggingBlock == nil then
1071
							imgLabel.Image = ""
1072
						end
1073
						draggingBlock = temp
1074
						return
1075
					end
1076
				end)
1077
			else
1078
				local invSlot = putInventorySlot(UDim2.new(0, 8 + ((i-1)*36), 0, 360), "", creativeInv, 4)
1079
				invSlot.MouseButton2Down:connect(function()
1080
					local imgLabel = invSlot:FindFirstChild("ImageLabel")
1081
					if imgLabel then
1082
						toolBar[i] = nil
1083
						imgLabel.Image = ""
1084
					end
1085
				end)
1086
				invSlot.MouseButton1Down:connect(function()
1087
					--updateHand = true
1088
					local imgLabel = invSlot:FindFirstChild("ImageLabel")
1089
					if toolBar[i] == nil then
1090
						toolBar[i] = draggingBlock
1091
						imgLabel.Image = draggingBlock.frontTex
1092
						draggingBlock = nil		
1093
						return				
1094
					end
1095
					if toolBar[i] ~= nil and draggingBlock == nil then
1096
						draggingBlock = toolBar[i]
1097
						toolBar[i] = nil
1098
						imgLabel.Image = ""
1099
						return
1100
					elseif toolBar[i] ~= nil and draggingBlock ~= nil then
1101
						--draggingBlock = toolBar[i]
1102
						--toolBar[i] = nil
1103
						imgLabel.Image = ""
1104
						local temp = toolBar[i]
1105
						toolBar[i] = draggingBlock
1106
						if imgLabel and draggingBlock ~= nil then 
1107
							imgLabel.Image = draggingBlock.frontTex
1108
						end 
1109
						if imgLabel and draggingBlock == nil then
1110
							imgLabel.Image = ""
1111
						end
1112
						draggingBlock = temp
1113
						return						
1114
					end
1115
				end)
1116
			end
1117
		end
1118
		return creativeInv
1119
	end
1120
end
1121
function putToolBarSlot(position, image, zindex)
1122
	local playerGui = player:FindFirstChild("PlayerGui")
1123
	if playerGui then
1124
		local gui = playerGui:FindFirstChild("ToolBar") or Instance.new("ScreenGui", playerGui)
1125
		gui.Name = "ToolBar"
1126
		local slot = Instance.new("ImageLabel", gui)
1127
		slot.Position = position
1128
		slot.Size = UDim2.new(0, 32, 0, 32)
1129
		slot.BackgroundTransparency = 1
1130
		slot.ImageTransparency = 0
1131
		slot.Image = image
1132
		slot.ZIndex = 2
1133
		
1134
		makeSquare(UDim2.new(0, 0, 0, 0), UDim2.new(0, 32, 0, 32), 
1135
			Color3.new(95/255, 89/255, 76/255), 0, slot)
1136
		makeSquare(UDim2.new(0, 0, 0, 0), UDim2.new(0, 2, 0, 32), 
1137
			Color3.new(0/255, 0/255, 0/255), 0.5, slot)
1138
		makeSquare(UDim2.new(0, 2, 0, 0), UDim2.new(0, 30, 0, 2), 
1139
			Color3.new(0/255, 0/255, 0/255), 0.5, slot)
1140
		makeSquare(UDim2.new(0, -2, 0, -2), UDim2.new(0, 36, 0, 2), 
1141
			Color3.new(106/255, 106/255, 106/255), 0, slot)
1142
		makeSquare(UDim2.new(0, -2, 0, -2), UDim2.new(0, 2, 0, 36), 
1143
			Color3.new(106/255, 106/255, 106/255), 0, slot)
1144
		makeSquare(UDim2.new(0, 0, 0, 32), UDim2.new(0, 34, 0, 2), 
1145
			Color3.new(130/255, 130/255, 130/255), 0, slot)
1146
		makeSquare(UDim2.new(0, 32, 0, 0), UDim2.new(0, 2, 0, 34), 
1147
			Color3.new(130/255, 130/255, 130/255), 0, slot)
1148
		makeSquare(UDim2.new(0, -4, 0, -2), UDim2.new(0, 2, 0, 38), 
1149
			Color3.new(130/255, 130/255, 130/255), 0, slot)
1150
		makeSquare(UDim2.new(0, 34, 0, -2), UDim2.new(0, 2, 0, 36), 
1151
			Color3.new(106/255, 106/255, 106/255), 0, slot)
1152
		makeSquare(UDim2.new(0, -2, 0, 34), UDim2.new(0, 38, 0, 2), 
1153
			Color3.new(106/255, 106/255, 106/255), 0, slot)
1154
		makeSquare(UDim2.new(0, -4, 0, -4), UDim2.new(0, 40, 0, 2), 
1155
			Color3.new(156/255, 156/255, 156/255), 0, slot)
1156
		return slot
1157
	end
1158
end
1159
function divide(x, d)
1160
	if x ~= 0 and d ~= 0 then
1161
		return x/d
1162
	else
1163
		return x
1164
	end
1165
end -- so it doesn't divide by zero
1166
function getDistance(v1, v2)
1167
	return math.abs((Vector3.new(math.abs(v2.X - v1.X), math.abs(v2.Y - v1.Y), math.abs(v2.Z - v1.Z))).Magnitude)
1168
end
1169
function round(x)
1170
  	if x%2 ~= 0.5 then
1171
    	return math.floor(x+0.5)
1172
  	end
1173
  	return x-0.5
1174
end
1175
function weldTo(part1, part2)
1176
	local weld = Instance.new("Weld", part1)
1177
	weld.Part0 = part1
1178
	weld.Part1 = part2
1179
end
1180
function getMagnitudeXZ(velocity)
1181
	return math.abs(velocity.X) + math.abs(velocity.Z)
1182
end
1183
function findHumanoid(inst)
1184
	local find = inst
1185
	local hum = nil
1186
	repeat
1187
		if find.Name == "Workspace" then return nil end
1188
		find = find.Parent
1189
		hum = find:FindFirstChild("Humanoid")
1190
	until hum
1191
	--if hum then print("found!!") else print("aw... not found") end
1192
	--if hum.ClassName ~= "Humanoid" then hum = nil end
1193
	return hum
1194
end
1195
function placeBlock(block, cFPos, Mouse)
1196
	if block == nil then
1197
		if Mouse.Target.Size.X <= 10 and Mouse.Target.Size.Y <= 10 and Mouse.Target.Size.Z <= 10 and Mouse.Target then
1198
			if Mouse.Target.Parent.Name ~= "Camera" then
1199
				--print(Mouse.Target:GetFullName())
1200
				local blkTar = Mouse.Target
1201
				--Mouse.Target.Parent = nil 
1202
				for i = 1, 9 do
1203
					local part = Instance.new("Part", workspace)
1204
					part.Size = Vector3.new(0, 0, 0)
1205
					part.Transparency = 1
1206
					part.CanCollide = false
1207
					part.Velocity = Vector3.new(math.random(-5, 5), 5, math.random(-5, 5))
1208
					part.Name = "Debris"
1209
					
1210
					part.CFrame = 
1211
						Mouse.Target.CFrame * 
1212
						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))
1213
									
1214
					local billboard = Instance.new("BillboardGui", part)
1215
					billboard.Size = UDim2.new(1.2, 0, 1.2, 0)
1216
									
1217
					local clipDescendant = Instance.new("TextLabel", billboard)
1218
					clipDescendant.Size = UDim2.new(0.5, 0, 0.5, 0)
1219
					clipDescendant.BackgroundTransparency = 1
1220
					clipDescendant.Text = ""
1221
					clipDescendant.ClipsDescendants = true
1222
									
1223
					local img = Instance.new("ImageLabel", clipDescendant)
1224
					img.Size = UDim2.new(2, 0, 2, 0)
1225
					img.BackgroundTransparency = 1
1226
					img.Position = UDim2.new((math.random(0, 100)-50)/100, 0, (math.random(0, 100)-50)/100, 0)
1227
									
1228
					local tex =  blkTar:FindFirstChild("Front")
1229
					if tex then
1230
						img.Image = tex.Texture
1231
					else
1232
						img.Image = "rbxassetid://744949545"
1233
					end
1234
						
1235
					if img.Image == "rbxassetid://744949545" then
1236
						img.ImageColor3 = blkTar.Color
1237
					end
1238
									
1239
					part.Touched:connect(function(prt)
1240
						if prt ~= blkTar then
1241
							part.CanCollide = true
1242
						end
1243
					end)								
1244
									
1245
					coroutine.resume(coroutine.create(function()
1246
						wait(math.random(50, 65)/100)
1247
						part:Destroy()
1248
					end))
1249
					--part.Anchored = false
1250
				end
1251
				blkTar:Destroy()
1252
			end
1253
		end
1254
		return nil
1255
	else
1256
		local blockPlaced = Instance.new("Part", workspace)
1257
		blockPlaced.Material = "Fabric"
1258
		blockPlaced.Transparency = block.transparency
1259
		blockPlaced.Anchored = true
1260
		blockPlaced.Size = block.size
1261
		blockPlaced.CFrame = cFPos
1262
		blockPlaced.Name = block.name
1263
		putTexture(blockPlaced, block.frontTex, block.backTex, 
1264
			block.topTex, block.bottomTex, block.leftTex, block.rightTex, "Texture")
1265
		
1266
		if block.hasGravity == true then
1267
			local connectedTo = Instance.new("ObjectValue", blockPlaced)
1268
			connectedTo.Name = "ConnectedTo"
1269
			blockPlaced.Anchored = false
1270
			local detector = Instance.new("Part", blockPlaced)
1271
			detector.Transparency = 1
1272
			detector.CanCollide = false
1273
			detector.Size = Vector3.new(1, 1, 1)
1274
			local weldDetector = Instance.new("Motor6D", detector)
1275
			weldDetector.Part0 = detector
1276
			weldDetector.Part1 = blockPlaced
1277
			weldDetector.C1 = CFrame.new(0, -blockPlaced.Size.Y/2, 0)
1278
			local landed = false
1279
			local function fallingBlock()
1280
				coroutine.resume(coroutine.create(function()
1281
					local falling = Instance.new("CFrameValue", blockPlaced)
1282
					falling.Name = "IsFalling"
1283
					local grav = 0
1284
					while RS:wait() do
1285
						if landed then falling:Destroy() break end
1286
						grav = math.max(-1, grav - 0.0025)
1287
						blockPlaced.CFrame = CFrame.new(cFPos.X, blockPlaced.CFrame.Y + grav, cFPos.Z)
1288
					end
1289
				end))
1290
			end
1291
			fallingBlock()
1292
			detector.Touched:connect(function(part)
1293
				if blockPlaced.Anchored == false and part ~= blockPlaced and part.Name ~= "Debris" and part:FindFirstChild("IsFalling") == nil and findHumanoid(part) == nil then
1294
					landed = true
1295
					blockPlaced.Velocity = Vector3.new(0, 0, 0)
1296
					blockPlaced.Anchored = true
1297
					connectedTo.Value = part
1298
					local yOrigin = part.CFrame.Y + (blockPlaced.Size.Y/2) + (part.Size.Y/2)
1299
					blockPlaced.CFrame = CFrame.new(cFPos.X, yOrigin, cFPos.Z)
1300
					--detector:Destroy()
1301
					local falling = false
1302
					part.Changed:connect(function()
1303
						if part.Position.Y ~= yOrigin and falling == false then
1304
							falling = true
1305
							wait(0.075)
1306
							landed = false
1307
							blockPlaced.Anchored = false
1308
							blockPlaced.Velocity = Vector3.new(0, 0, 0)
1309
							fallingBlock()
1310
							falling = false
1311
						end
1312
					end)
1313
					workspace.ChildRemoved:connect(function()
1314
						--print("hi")
1315
						if connectedTo.Value.Parent == nil and falling == false then
1316
							falling = true
1317
							landed = false
1318
							blockPlaced.Anchored = false
1319
							blockPlaced.Velocity = Vector3.new(0, 0, 0)
1320
							fallingBlock()
1321
						end
1322
					end)
1323
				end
1324
			end)
1325
		end
1326
		
1327
		local blockSound = Instance.new("Sound", blockPlaced)
1328
		blockSound.SoundId = block.sound
1329
		blockSound.Volume = block.soundVol
1330
		blockSound.Pitch = math.random(95, 105)/100
1331
		blockSound.PlayOnRemove = true
1332
		blockSound:Play()
1333
		return blockPlaced
1334
	end
1335
end
1336
if player then
1337
	local char = player.Character
1338
	if char then
1339
		for _,cM in pairs(char:GetChildren()) do
1340
			if cM.ClassName == "CharacterMesh" then cM:Destroy() end
1341
		end
1342
		
1343
		--[]
1344
		local gui = player.PlayerGui:FindFirstChild("ToolBar") or Instance.new("ScreenGui", player.PlayerGui)
1345
		gui.Name = "ToolBar"
1346
		
1347
		makeSquare(UDim2.new(0.5, -166, 1, -111), UDim2.new(0, 364, 0, 44), 
1348
			Color3.new(0/255, 0/255, 0/255), 0, gui)
1349
		
1350
		for i = 1, 9 do
1351
			if toolBar[i] ~= nil then
1352
				local img = putToolBarSlot(UDim2.new(0.5, -160 + ((i-1)*40), 1, -105), toolBar[i].frontTex)
1353
				coroutine.resume(coroutine.create(function()
1354
					while wait() do
1355
						if toolBar[i] ~= nil then
1356
							img.Image = toolBar[i].frontTex
1357
						else
1358
							img.Image = ""
1359
						end
1360
					end
1361
				end))
1362
			else
1363
				local img = putToolBarSlot(UDim2.new(0.5, -160 + ((i-1)*40), 1, -105), "")
1364
				coroutine.resume(coroutine.create(function()
1365
					while wait() do
1366
						if toolBar[i] ~= nil then
1367
							img.Image = toolBar[i].frontTex
1368
						else
1369
							img.Image = ""
1370
						end
1371
					end
1372
				end))
1373
			end
1374
		end
1375
		
1376
		local creativeInventoryGUI = makeInventory()
1377
		
1378
		local humRootPart = char:WaitForChild("HumanoidRootPart")
1379
		local head = char:WaitForChild("Head")
1380
		local torso = char:WaitForChild("Torso")
1381
		local lArm = char:WaitForChild("Left Arm")
1382
		local rArm = char:WaitForChild("Right Arm")
1383
		local lLeg = char:WaitForChild("Left Leg")
1384
		local rLeg = char:WaitForChild("Right Leg")
1385
		
1386
		local humanoid = char:WaitForChild("Humanoid")	
1387
		char.Humanoid:ClearAllChildren()
1388
		humanoid.HipHeight = 0.3	
1389
		
1390
		humanoid.Parent = nil
1391
		
1392
		if char:FindFirstChild("Animate") then
1393
			char.Animate:Remove()
1394
		end
1395
		
1396
		head.Size = Vector3.new(1.3, 1.3, 1.3)
1397
		putTexture(head, "rbxassetid://38738031", "rbxassetid://36047330", 
1398
			"rbxassetid://36047341", "rbxassetid://36047347",
1399
			"rbxassetid://36047323", "rbxassetid://36047315", "Decal")
1400
		head:WaitForChild("Mesh"):Destroy()
1401
		head:WaitForChild("face"):Destroy()
1402
		
1403
		torso.Size = Vector3.new(1.3, 1.95, 0.65)
1404
		putTexture(torso, "rbxassetid://38934753", "rbxassetid://38934731", 
1405
			"rbxassetid://38934780", "rbxassetid://38934740",
1406
			"rbxassetid://38934762", "rbxassetid://38934762", "Decal")
1407
		
1408
		lArm.Size = Vector3.new(0.65, 1.95, 0.65)
1409
		putTexture(lArm, "rbxassetid://38934581", "rbxassetid://38934560", 
1410
			"rbxassetid://38934613", "rbxassetid://38934568",
1411
			"rbxassetid://38934601", "rbxassetid://38934591", "Decal")
1412
		
1413
		rArm.Size = Vector3.new(0.65, 1.95, 0.65)
1414
		putTexture(rArm, "rbxassetid://38934560", "rbxassetid://38934581", 
1415
			"rbxassetid://38934613", "rbxassetid://38934568",
1416
			"rbxassetid://38934601", "rbxassetid://38934591", "Decal")
1417
		
1418
		lLeg.Size = Vector3.new(0.65, 1.95, 0.65)
1419
		putTexture(lLeg, "rbxassetid://38936226", "rbxassetid://38936209", 
1420
			"rbxassetid://38934719", "rbxassetid://38934712",
1421
			"rbxassetid://38936255", "rbxassetid://38936242", "Decal")
1422
		
1423
		rLeg.Size = Vector3.new(0.65, 1.95, 0.65)
1424
		putTexture(rLeg, "rbxassetid://38936209", "rbxassetid://38936226", 
1425
			"rbxassetid://38934719", "rbxassetid://38934712",
1426
			"rbxassetid://38936242", "rbxassetid://38936255", "Decal")
1427
		
1428
		-- now for the real stuff
1429
		-- |
1430
		-- |
1431
		-- V
1432
		Instance.new("BlockMesh", torso)
1433
		Instance.new("BlockMesh", lArm)
1434
		Instance.new("BlockMesh", rArm)
1435
		Instance.new("BlockMesh", lLeg)
1436
		Instance.new("BlockMesh", rLeg)
1437
		
1438
		local camera = workspace.Camera
1439
		
1440
		local camPart = Instance.new("Part", camera)
1441
		camPart.Size = Vector3.new(0, 0, 0)
1442
		camPart.CFrame = camera.CFrame
1443
		camPart.CanCollide = false
1444
		camPart.Anchored = true
1445
		camPart.Transparency = 1
1446
		
1447
		local cameraHand = Instance.new("Part", camera)
1448
		cameraHand.Size = Vector3.new(0.65, 1.95, 0.65)
1449
		cameraHand.CanCollide = false
1450
		cameraHand.Anchored = true
1451
		cameraHand.Name = "CameraHand"
1452
		putTexture(cameraHand, "rbxassetid://38934560", "rbxassetid://38934581", 
1453
			"rbxassetid://38934613", "rbxassetid://38934568",
1454
			"rbxassetid://38934601", "rbxassetid://38934591", "Decal")
1455
		
1456
		local cameraHandItem = Instance.new("Part", camera)
1457
		cameraHandItem.Name = "CameraHandItem"
1458
		cameraHandItem.Size = Vector3.new(1.1, 1.1, 1.1)
1459
		cameraHandItem.Anchored = true
1460
		cameraHandItem.CanCollide = false
1461
		cameraHandItem.Transparency = 1	
1462
		
1463
		-- welding doesn't really work.
1464
		--local cameraHandWeld = Instance.new("Motor6D", camPart)
1465
		--cameraHandWeld.Part0 = camPart
1466
		--cameraHandWeld.Part1 = cameraHand
1467
		--cameraHandWeld.C0 = CFrame.new(5, 0, 0)
1468
1469
		local rootJoint = torso:FindFirstChild("RootJoint") or Instance.new("Motor6D", torso)
1470
		rootJoint.Name = "RootJoint"
1471
		rootJoint.Part0 = humRootPart
1472
		rootJoint.Part1 = torso
1473
		rootJoint.C1 = CFrame.new(0, 0.05, 0)
1474
		
1475
		local neck = torso:FindFirstChild("Neck") or Instance.new("Motor6D", torso)
1476
		neck.Name = "Neck"
1477
		neck.Part0 = head
1478
		neck.Part1 = torso
1479
		
1480
		local lS = torso:FindFirstChild("Left Shoulder") or Instance.new("Motor6D", torso)
1481
		lS.Name = "Left Shoulder"
1482
		lS.Part0 = lArm
1483
		lS.Part1 = torso
1484
		lS.C0 = CFrame.new(-0.325, 0.975, 0) * CFrame.Angles(0, 0, 0)
1485
		lS.C1 = CFrame.new(0.65, 0.975, 0)
1486
1487
		local rS = torso:FindFirstChild("Right Shoulder") or Instance.new("Motor6D", torso)
1488
		rS.Name = "Right Shoulder"
1489
		rS.Part0 = rArm
1490
		rS.Part1 = torso
1491
		rS.C0 = CFrame.new(-0.325, 0.975, 0) * CFrame.Angles(0, 0, 0)
1492
		rS.C1 = CFrame.new(-0.65, 0.975, 0) * CFrame.Angles(0, -math.rad(180), 0)
1493
1494
		local lH = torso:FindFirstChild("Left Hip") or Instance.new("Motor6D", torso)
1495
		lH.Name = "Left Hip"
1496
		lH.Part0 = lLeg
1497
		lH.Part1 = torso
1498
		lH.C0 = CFrame.new(0, 0.975, 0)
1499
		lH.C1 = CFrame.new(0.325, -0.975, 0) * CFrame.Angles(0, 0, 0)
1500
1501
		local rH = torso:FindFirstChild("Right Hip") or Instance.new("Motor6D", torso)
1502
		rH.Name = "Right Hip"
1503
		rH.Part0 = rLeg
1504
		rH.Part1 = torso
1505
		rH.C0 = CFrame.new(0, 0.975, 0)
1506
		rH.C1 = CFrame.new(-0.325, -0.975, 0) * CFrame.Angles(0, -math.rad(180), 0)
1507
		
1508
		for _,p in pairs(char:GetChildren()) do
1509
			if p.Name ~= "HumanoidRootPart" and p.ClassName == "Part" then
1510
				local hit = Instance.new("Part", char)
1511
				hit.Name = "DamagePart"
1512
				hit.BrickColor = BrickColor.new("Bright red")
1513
				hit.Material = "SmoothPlastic"
1514
				hit.Transparency = 1
1515
				hit.Size = Vector3.new(p.Size.X + 0.05, p.Size.Y + 0.05, p.Size.Z + 0.05)
1516
				hit.CanCollide = false
1517
				weldTo(hit, p)
1518
			end
1519
		end
1520
		
1521
		wait(0.25)
1522
		
1523
		humanoid.Parent = char
1524
		
1525
		local ticks = 0
1526
		local times = 0
1527
		
1528
		local walkAnim = 0
1529
		local increaseWalkAnim = 1
1530
		
1531
		local idleAnimRotX = 0
1532
		local idleAnimRotZ = 0
1533
		local sneaking = 0
1534
		
1535
		--local RS = game:GetService("RunService").RenderStepped
1536
		local Mouse = player:GetMouse()		
1537
		
1538
		local oldHP = humanoid.Health
1539
		local damageTime = 0
1540
		
1541
		local punchRotX = 0
1542
		local punchRotY = 0
1543
		local punchRotZ = 0
1544
		local punchRotXcam = 0
1545
		local punchRotYcam = 0
1546
		local punchRotZcam = 0
1547
		local punchSpeed = 0
1548
		local punching = 0
1549
		local selectedBlock = 8
1550
		local punchEnded = 1
1551
		local itemOnHand = nil
1552
		
1553
		local selectBox = Instance.new("SelectionBox", camera)	
1554
		selectBox.Transparency = 0.5
1555
		selectBox.Color3 = Color3.new(0, 0, 0)
1556
		selectBox.LineThickness = 0	
1557
		
1558
		local handItem = Instance.new("Part", char)
1559
		handItem.Name = "HandItem"
1560
		handItem.Size = Vector3.new(0.52, 0.52, 0.52)
1561
		handItem.Transparency = 1	
1562
		handItem.CanCollide = false
1563
		
1564
		local handItemWeld = Instance.new("Weld", char)
1565
		handItemWeld.Part0 = handItem
1566
		handItemWeld.Part1 = lArm
1567
		handItemWeld.C1 = CFrame.new(0, -0.9, -0.6) * CFrame.Angles(math.rad(-10), math.rad(45), 0)	
1568
		
1569
		local sound = Instance.new("Sound", char)
1570
		sound.Name = "Hurt"
1571
		sound.Volume = 10
1572
		sound.SoundId = "rbxassetid://535690488"		
1573
		
1574
		local facesToResize = {"Front", "Back", "Left", "Right", "Bottom", "Top"}
1575
		
1576
		local camCurrentZoom = (camera.CFrame.p - head.Position).magnitude
1577
		Mouse.Button1Down:connect(function()
1578
			if punchEnded == 1 then punching = 1 end
1579
			if Mouse.Target then
1580
				if getDistance(head.CFrame.p, Mouse.Hit.p) <= 10.4 then
1581
					local humanoid = Mouse.Target.Parent:FindFirstChild("Humanoid")
1582
					if humanoid then
1583
						humanoid.Health = humanoid.Health - 10
1584
						local parts = Mouse.Target.Parent:GetChildren()
1585
						for _,p in pairs(parts) do
1586
							if p.ClassName == "Part" then
1587
								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))
1588
							end
1589
						end
1590
						return
1591
					end
1592
					local x = Mouse.Target.CFrame.p.X
1593
					local y = Mouse.Target.CFrame.p.Y
1594
					local z = Mouse.Target.CFrame.p.Z
1595
					if Mouse.TargetSurface.Name == "Right" then x = x + 2.6 end
1596
					if Mouse.TargetSurface.Name == "Left" then x = x - 2.6 end
1597
					if Mouse.TargetSurface.Name == "Top" then y = y + 2.6 end
1598
					if Mouse.TargetSurface.Name == "Bottom" then y = y - 2.6 end
1599
					if Mouse.TargetSurface.Name == "Back" then z = z + 2.6 end
1600
					if Mouse.TargetSurface.Name == "Front" then z = z - 2.6 end
1601
					if Mouse.Target.Size.X > 2.6 or Mouse.Target.Size.Y > 2.6 or Mouse.Target.Size.Z > 2.6 then
1602
						x = Mouse.Hit.p.X
1603
						y = Mouse.Hit.p.Y
1604
						z = Mouse.Hit.p.Z
1605
					end
1606
	--				local x = round(math.abs(mouseX)/2.6)*2.6
1607
	--				local y = round(math.abs(mouseY)/2.6)*2.6
1608
	--				local z = round(math.abs(mouseZ)/2.6)*2.6
1609
	--				if Mouse.Hit.p.X < 0 then x = x * -1 end
1610
	--				if Mouse.Hit.p.Y < 0 then y = y * -1 end
1611
	--				if Mouse.Hit.p.Z < 0 then z = z * -1 end
1612
					local blk = placeBlock(toolBar[selectedBlock + 1], CFrame.new(x, y, z), Mouse)
1613
					if blk then
1614
						for _,f in pairs(facesToResize) do
1615
							blk:WaitForChild(f).StudsPerTileU = 2.6
1616
							blk:WaitForChild(f).StudsPerTileV = 2.6
1617
						end
1618
					end
1619
				end
1620
			end
1621
		end)		
1622
		
1623
		local changedItem = false
1624
		local hasItemOnHand = 0
1625
		local hi = 0
1626
		-- selection thingy
1627
		local selectLabel = Instance.new("TextLabel", gui)
1628
		selectLabel.Size = UDim2.new(0, 32, 0, 32)
1629
		selectLabel.Position = UDim2.new(0.5, -160 + (selectedBlock*40), 1, -105)
1630
		selectLabel.BackgroundTransparency = 0.5
1631
		selectLabel.BackgroundColor3 = Color3.new(1, 1, 1)
1632
		selectLabel.BorderSizePixel = 0
1633
		selectLabel.Text = ""
1634
		selectLabel.ZIndex = 3
1635
		--	
1636
		local oldItemOnHand = itemOnHand
1637
		function updateItemOnHand()
1638
			for _,d in pairs(handItem:GetChildren()) do
1639
				d:Destroy()
1640
			end
1641
			for _,d in pairs(cameraHandItem:GetChildren()) do
1642
				d:Destroy()
1643
			end
1644
			if itemOnHand ~= nil then
1645
				putTexture(handItem, itemOnHand.frontTex, itemOnHand.backTex,
1646
					itemOnHand.topTex, itemOnHand.bottomTex,
1647
					itemOnHand.leftTex, itemOnHand.rightTex, "Texture")
1648
				
1649
				putTexture(cameraHandItem, itemOnHand.frontTex, itemOnHand.backTex,
1650
					itemOnHand.topTex, itemOnHand.bottomTex,
1651
					itemOnHand.leftTex, itemOnHand.rightTex, "Texture")
1652
				
1653
				for _,f in pairs(facesToResize) do
1654
					handItem:WaitForChild(f).StudsPerTileU = 0.52
1655
					handItem:WaitForChild(f).StudsPerTileV = 0.52
1656
				end
1657
				
1658
				for _,f in pairs(facesToResize) do
1659
					cameraHandItem:WaitForChild(f).StudsPerTileU = 1.1
1660
					cameraHandItem:WaitForChild(f).StudsPerTileV = 1.1
1661
				end
1662
				
1663
				cameraHand.Transparency = 1
1664
				for _,f in pairs(facesToResize) do
1665
					cameraHand:WaitForChild(f).Transparency = 1
1666
					cameraHand:WaitForChild(f).Transparency = 1
1667
				end
1668
			else
1669
				cameraHand.Transparency = 0
1670
				for _,f in pairs(facesToResize) do
1671
					cameraHand:WaitForChild(f).Transparency = 0
1672
					cameraHand:WaitForChild(f).Transparency = 0
1673
				end
1674
			end
1675
			if oldItemOnHand ~= itemOnHand then
1676
				changedItem = true
1677
			end
1678
		end		
1679
		
1680
		local pressedWTimes = 0
1681
		local sprintingNum = 0
1682
		local sprinting = false
1683
		Mouse.KeyDown:connect(function(key)
1684
			if sprinting == false then sprintingNum = 0 else sprintingNum = 1 end
1685
			if (key == "w" and sprinting == false and sneaking == 0) then
1686
				if pressedWTimes >= 1 or key == Enum.KeyCode.LeftControl then
1687
					sprinting = true
1688
					humanoid.WalkSpeed = humanoid.WalkSpeed * 1.5
1689
					pressedWTimes = 0
1690
					coroutine.resume(coroutine.create(function()
1691
						for i = 1, 24 do
1692
							camera.FieldOfView = camera.FieldOfView + ((24-i)/10)
1693
							RS:wait()
1694
						end
1695
					end))
1696
				end
1697
				pressedWTimes = pressedWTimes + 1
1698
				coroutine.resume(coroutine.create(function()
1699
					for i = 1, 12 do
1700
						if sprinting == true then break end
1701
						wait()
1702
					end
1703
					pressedWTimes = 0
1704
				end))
1705
			end
1706
			if key == "q" and sprinting == false then
1707
				sneaking = 1
1708
				humanoid.WalkSpeed = humanoid.WalkSpeed / 2
1709
				humanoid.HipHeight = humanoid.HipHeight - 0.35
1710
				rootJoint.C1 = CFrame.new(0, 0.325, 0) * CFrame.Angles(math.rad(sneaking*45), 0, 0)
1711
				lH.C0 = CFrame.new(0, 0.975, 0) * CFrame.Angles(-math.rad(sneaking*45), 0, 0)
1712
				rH.C0 = CFrame.new(0, 0.975, 0) * CFrame.Angles(math.rad(sneaking*45), 0, 0)
1713
				--print("Sneaking...")
1714
			end
1715
			if key == "e" then
1716
				if creativeInventoryGUI.Visible == true then
1717
					creativeInventoryGUI.Visible = false
1718
				elseif creativeInventoryGUI.Visible == false then
1719
					creativeInventoryGUI.Visible = true
1720
				end
1721
			end
1722
			if key == "1" or key == "2" or key == "3" or
1723
				 key == "4" or key == "5" or key == "6" or
1724
				 key == "7" or key == "8" or key == "9" then
1725
				selectedBlock = tonumber(key) - 1
1726
				oldItemOnHand = itemOnHand
1727
				itemOnHand = toolBar[tonumber(key)]
1728
				updateItemOnHand()
1729
				if hasItemOnHand == 0 and itemOnHand then hi = 1 end
1730
				if hasItemOnHand == 1 and itemOnHand == nil then hi = 1 end
1731
			end
1732
			--if (key == "0" or key == "1" or key == "2" 
1733
			--	or key == "3" or key == "4" or key == "5"
1734
			--	or key == "6" or key == "7") and hasItemOnHand == 0 then hi = 1 end
1735
			selectLabel.Position = UDim2.new(0.5, -160 + ((selectedBlock)*40), 1, -105)
1736
		end)
1737
		
1738
		Mouse.KeyUp:connect(function(key)
1739
			if sprinting == false then sprintingNum = 0 else sprintingNum = 1 end
1740
			if (key == "w" and sprinting == true and sneaking == 0) then
1741
				sprinting = false
1742
				humanoid.WalkSpeed = humanoid.WalkSpeed / 1.5
1743
				coroutine.resume(coroutine.create(function()
1744
					for i = 1, 24 do
1745
						camera.FieldOfView = camera.FieldOfView - ((24-i)/10)
1746
						RS:wait()
1747
					end
1748
				end))
1749
			end
1750
			if key == "q" and sprinting == false then
1751
				sneaking = 0
1752
				humanoid.WalkSpeed = humanoid.WalkSpeed * 2
1753
				humanoid.HipHeight = humanoid.HipHeight + 0.35
1754
				rootJoint.C1 = CFrame.new(0, 0.05, 0) * CFrame.Angles(0, 0, 0)
1755
				lH.C0 = CFrame.new(0, 0.975, 0) * CFrame.Angles(0, 0, 0)
1756
				rH.C0 = CFrame.new(0, 0.975, 0) * CFrame.Angles(0, 0, 0)
1757
				--print("Stopped sneaking...")
1758
			end
1759
		end)
1760
		
1761
		Mouse.TargetFilter = camera
1762
		
1763
		local humOffset = CFrame.new(0, 0, 0)
1764
		local camHandY = 0
1765
		local cameraHandCFrame = CFrame.new(1.15, -1.35, -2) * CFrame.fromEulerAnglesXYZ(math.rad(90), math.rad(55), math.rad(20))
1766
		while RS:wait() do
1767
			camCurrentZoom = ((CFrame.new(0, -1*sneaking, 0) * camera.CFrame).p - head.Position).magnitude
1768
			if itemOnHand ~= nil then 
1769
				hasItemOnHand = 1 
1770
				handItem.Transparency = itemOnHand.transparency
1771
			else 
1772
				hasItemOnHand = 0 
1773
				handItem.Transparency = 1
1774
			end
1775
			if humanoid.Health < oldHP then
1776
				damageTime = 60
1777
				sound:Play()
1778
			end
1779
			oldHP = humanoid.Health
1780
			if damageTime > 0 and humanoid.Health > 0 then
1781
				for _,p in pairs(char:GetChildren()) do
1782
					if p.Name ~= "HumanoidRootPart" and p.ClassName == "Part" then
1783
						if p.Name == "DamagePart" then
1784
							p.Transparency = 0.5
1785
						end
1786
					end
1787
				end
1788
				damageTime = damageTime - 2
1789
				if damageTime <= 0 then
1790
					for _,p in pairs(char:GetChildren()) do
1791
						if p.Name ~= "HumanoidRootPart" and p.ClassName == "Part" then
1792
							if p.Name == "DamagePart" then
1793
								p.Transparency = 1
1794
							end
1795
						end
1796
					end
1797
				end
1798
			end
1799
			camPart.CFrame = camera.CFrame
1800
			neck.C1 = CFrame.new(0, 0.975, 0) * CFrame.fromEulerAnglesXYZ(math.rad(sneaking*45), math.rad(camPart.Orientation.Y - torso.Orientation.Y), 0)
1801
			neck.C0 = CFrame.new(0, -0.65, 0) * CFrame.Angles(-math.rad(camPart.Orientation.X - torso.Orientation.X - (sneaking*45)), 0, 0)		
1802
			
1803
			if getMagnitudeXZ(torso.Velocity) > 1 then
1804
				if walkAnim >= 1 then
1805
					increaseWalkAnim = -1
1806
				elseif walkAnim <= -1 then
1807
					increaseWalkAnim = 1
1808
				end
1809
				walkAnim = walkAnim + (increaseWalkAnim/(10+(sneaking*20)))
1810
			else
1811
				walkAnim = 0
1812
			end
1813
			
1814
			--lH.C0 = CFrame.new(0, 0.975, 0) * CFrame.Angles(-math.rad(sneaking*45), 0, 0)
1815
			--rH.C0 = CFrame.new(0, 0.975, 0) * CFrame.Angles(math.rad(sneaking*45), 0, 0)
1816
			lH.C0 = lH.C0:lerp(CFrame.new(0, 0.975, 0) * CFrame.Angles(-math.rad(sneaking*45) + math.rad(damageTime*1.5) + math.rad(walkAnim*getMagnitudeXZ(torso.Velocity)*5/(1+sneaking)), 0, 0), 0.1)
1817
	    	rH.C0 = rH.C0:lerp(CFrame.new(0, 0.975, 0) * CFrame.Angles(math.rad(sneaking*45) + math.rad(damageTime*1.5) + math.rad(walkAnim*getMagnitudeXZ(torso.Velocity)*5/(1+sneaking)), 0, 0), 0.1)
1818
			--
1819
			--rootJoint.C0 = CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0)
1820
			--print(math.abs(head.Orientation.Y) - math.abs(humRootPart.Orientation.Y))
1821
			--if (head.Orientation.Y * 2) - (head.Orientation.Y + torso.Orientation.Y) > 45 then
1822
				--humRootPart.CFrame = humRootPart.CFrame * CFrame.Angles(0, math.rad(-45 + head.Orientation.Y), 0)
1823
				--print("-45")
1824
			--end
1825
			--if (head.Orientation.Y * 2) - (head.Orientation.Y + torso.Orientation.Y) < -45 then
1826
				--humRootPart.CFrame = humRootPart.CFrame * CFrame.Angles(0, math.rad(45 + head.Orientation.Y), 0)
1827
				--print("45")
1828
			--end
1829
			
1830
			if changedItem then
1831
				changedItem = false
1832
				coroutine.resume(coroutine.create(function()
1833
					for i = 1, 8 do
1834
						camHandY = camHandY - 0.2
1835
						RS:wait()
1836
					end
1837
					for i = 1, 8 do
1838
						camHandY = camHandY + 0.2
1839
						RS:wait()
1840
					end
1841
				end))
1842
			end			
1843
			
1844
			--move these arms
1845
			rootJoint.C1 = rootJoint.C1:lerp(CFrame.new(0, 0.325, 0) * CFrame.Angles(math.rad(sneaking*45), math.rad(punchRotY), 0), 0.2)
1846
			
1847
	    	lS.C0 = lS.C0:lerp(CFrame.new(-0.325, 0.975, 0) * CFrame.Angles(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) + divide(punchSpeed, 6) + hi)
1848
	    	rS.C0 = rS.C0:lerp(CFrame.new(-0.325, 0.975, 0) * CFrame.Angles(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))
1849
			
1850
			if Mouse.Target and getDistance(head.CFrame.p, Mouse.Hit.p) <= 10.4 then 
1851
				if Mouse.Target.Parent:FindFirstChild("Humanoid") == nil and Mouse.Target.Parent ~= camera then
1852
					selectBox.Adornee = Mouse.Target
1853
				else 
1854
					selectBox.Adornee = nil 
1855
				end
1856
			else 
1857
				selectBox.Adornee = nil 
1858
			end		
1859
			
1860
			local BobbingY = walkAnim*2
1861
			if BobbingY >= 1 then BobbingY = -BobbingY + 0.5 end
1862
			
1863
			cameraHandCFrame = cameraHandCFrame:lerp(CFrame.new(1.15*1.3 + (walkAnim/2 - (walkAnim/3)), -1.35*1.3 + camHandY + (-BobbingY/8), -0.45 + ((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(90), math.rad(55), math.rad(35)), 0.25)
1864
			
1865
			humOffset = humOffset:lerp(CFrame.new(walkAnim/4 - (walkAnim/8), BobbingY/13, 0), 0.25)
1866
			humanoid.CameraOffset = Vector3.new(humOffset.X, humOffset.Y, 0)
1867
			
1868
			cameraHand.CFrame = camPart.CFrame * cameraHandCFrame
1869
			
1870
			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)
1871
			
1872
			if camCurrentZoom >= 1.5 then
1873
				cameraHand.Transparency = 1
1874
				for _,t in pairs(cameraHand:GetChildren()) do
1875
					if t.Transparency == 0 then
1876
						t.Transparency = 1
1877
					end
1878
				end
1879
				for _,t in pairs(cameraHandItem:GetChildren()) do
1880
					if t.Transparency == 0 then
1881
						t.Transparency = 1
1882
					end				
1883
				end
1884
			else
1885
				cameraHand.Transparency = hasItemOnHand
1886
				for _,t in pairs(cameraHand:GetChildren()) do
1887
					if t.Transparency == 1 then
1888
						t.Transparency = hasItemOnHand
1889
					end
1890
				end
1891
				for _,t in pairs(cameraHandItem:GetChildren()) do
1892
					if t.Transparency == 1 then
1893
						t.Transparency = 0
1894
					end				
1895
				end				
1896
			end		
1897
			
1898
			if updateHand == true then
1899
				updateHand = false
1900
				updateItemOnHand()
1901
			end
1902
			
1903
			if punching == 1 and punchEnded == 1 then
1904
				punching = 0
1905
				--print("steve uses punch!!")
1906
				local coPunchCam = coroutine.wrap(function()
1907
					local mult = 2
1908
					punchRotXcam = 40/2*mult
1909
					punchRotYcam = 25/2*mult
1910
					wait(0.075/2)
1911
					punchRotXcam = 50/2*mult
1912
					punchRotYcam = 25*mult
1913
					punchRotZcam = -10*mult
1914
					wait(0.075/2)
1915
					punchRotYcam = 50/1.5*mult
1916
					punchRotXcam = -10*mult
1917
					--wait(0.075/2)
1918
					--punchRotYcam = 50
1919
					--punchRotXcam = -10
1920
					wait(0.02)
1921
					punchRotXcam = -20*mult
1922
					wait(0.055)
1923
					punchRotXcam = 0
1924
					punchRotYcam = 0
1925
					punchRotZcam = 0
1926
				end)
1927
				local coPunch = coroutine.wrap(function()
1928
					punchEnded = 0
1929
					punchSpeed = 1
1930
					punchRotX = -60
1931
					punchRotY = -8
1932
					punchRotZ = -35
1933
					
1934
					wait(0.075/1.3)
1935
					punchSpeed = 1
1936
					punchRotX = -75
1937
					punchRotY = 8
1938
					punchRotZ = 40
1939
					wait(0.075/1.3)
1940
					punchSpeed = 1
1941
					punchRotX = -20
1942
					punchRotZ = 40
1943
					wait(0.075/1.3)
1944
					punchSpeed = 3.5
1945
					punchRotX = 0
1946
					punchRotY = 0
1947
					punchRotZ = 0
1948
					
1949
					punchRotXcam = 0
1950
					punchRotYcam = 0
1951
					punchRotZcam = 0				
1952
					
1953
					punchEnded = 1
1954
					wait(0.06/1.3)	
1955
					punchSpeed = 0			
1956
				end)
1957
				coPunch()
1958
				coPunchCam()
1959
			end			
1960
			if ticks > 20 then
1961
				ticks = 0
1962
				if times == 0 then
1963
					times = times + 1
1964
					idleAnimRotX = -1
1965
					idleAnimRotZ = 0
1966
				elseif times == 1 then
1967
					times = times + 1
1968
					idleAnimRotX = -0.75
1969
					idleAnimRotZ = -0.75
1970
				elseif times == 2 then
1971
					times = times + 1
1972
					idleAnimRotX = 0
1973
					idleAnimRotZ = -1
1974
				elseif times == 3 then
1975
					times = times + 1
1976
					idleAnimRotX = 0.75
1977
					idleAnimRotZ = -0.75
1978
					--idleAnimRotX = 0.75
1979
					--idleAnimRotZ = -0
1980
				elseif times == 4 then
1981
					times = times + 1
1982
					idleAnimRotX = 1
1983
					idleAnimRotZ = 0
1984
					--idleAnimRotX = 1
1985
					--idleAnimRotZ = 0
1986
				elseif times == 5 then
1987
					times = times + 1
1988
					idleAnimRotX = 0.75
1989
					idleAnimRotZ = 0.75
1990
				elseif times == 6 then
1991
					times = times + 1
1992
					idleAnimRotX = 0
1993
					idleAnimRotZ = 1
1994
				elseif times == 7 then
1995
					times = 0
1996
					idleAnimRotX = -0.75
1997
					idleAnimRotZ = 0.75
1998
				end
1999
			end
2000
			if hi == 1 then hi = 0 end
2001
			ticks = ticks + 1
2002
		end
2003
	end
2004
end
2005
end)
2006
2007
coming.Name = "coming"
2008
coming.Parent = Gui
2009
coming.BackgroundColor3 = Color3.new(1, 1, 1)
2010
coming.Position = UDim2.new(0, 0, 0.64940238, 0)
2011
coming.Size = UDim2.new(0, 200, 0, 50)
2012
coming.Font = Enum.Font.SourceSans
2013
coming.Text = "Coming Soon..."
2014
coming.TextColor3 = Color3.new(0, 0, 0)
2015
coming.TextSize = 14