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