View difference between Paste ID: ZdHwPSsR and cCSkZq0K
SHOW: | | - or go back to the newest paste.
1-
-- ORIGINAL CREATOR: Depr1
1+
 
2-
--Fixed lags by stommmDev for toasters if the creator wants to shut down this script i will
2+
3-
-- If this script isn't on pastebin or the user who uploaded this isn't called "Delros12"
3+
4-
-- (and yes my pastebin account is Delros12) or the link is not https://pastebin.com/2NNDTLjL
4+
5-
-- then this is not the original link of this script. 
5+
6
		makeSquare(UDim2.new(0, 2, 0, 0), UDim2.new(0, 30, 0, 2), 
7-
-- The original link of the script gets edited constantly for updates, if you use the original
7+
8-
-- link you will be able to enjoy the most recent updates of this script without changing to 
8+
9-
-- another link which contains updated script.
9+
10
		makeSquare(UDim2.new(0, -2, 0, -2), UDim2.new(0, 2, 0, 36), 
11-
-- Enjoy! :)
11+
12
		makeSquare(UDim2.new(0, 0, 0, 32), UDim2.new(0, 34, 0, 2), 
13-
-- Controls: Q to sneak, use the keypad numbers 1-9 to change blocks, choose a empty slot i
13+
14-
-- you want to remove a block.
14+
15
			Color3.new(130/255, 130/255, 130/255), 0, slot)
16-
-- this script will transform you into steve when used
16+
17
			Color3.new(130/255, 130/255, 130/255), 0, slot)
18-
local targetName = game.Players.LocalPlayer.Name
18+
19-
local player = game.Players:FindFirstChild(targetName)
19+
20-
function putTexture(part, frontF, backF, topF, bottomF, leftF, rightF, className)
20+
21-
	local faces = {"Front", "Back", "Top", "Bottom", "Left", "Right"}
21+
22-
	for i,f in pairs(faces) do
22+
23-
		local decal = Instance.new(className, part)
23+
24-
		if i == 1 then decal.Texture = frontF decal.Name = f end
24+
25-
		if i == 2 then decal.Texture = backF or frontF decal.Name = f  end
25+
26-
		if i == 3 then decal.Texture = topF or frontF decal.Name = f  end
26+
27-
		if i == 4 then decal.Texture = bottomF or frontF decal.Name = f end
27+
28-
		if i == 5 then decal.Texture = leftF or frontF decal.Name = f  end
28+
29-
		if i == 6 then decal.Texture = rightF or frontF decal.Name = f  end
29+
30-
		decal.Face = f
30+
31
	end
32-
	return part
32+
33
function getDistance(v1, v2)
34-
function makeSquare(position, size, color, transparency, parent)
34+
35-
	local label = Instance.new("TextLabel", parent)
35+
36-
	label.Text = ""
36+
37-
	label.BorderSizePixel = 0
37+
38-
	label.BackgroundTransparency = transparency
38+
39-
	label.Position = position
39+
  	end            
40-
	label.Size = size
40+
41-
	label.BackgroundColor3 = color
41+
42
function weldTo(part1, part2)
43-
function putToolBarSlot(position, image)
43+
44-
	local playerGui = player:FindFirstChild("PlayerGui")
44+
45-
	if playerGui then
45+
46-
		local gui = playerGui:FindFirstChild("ToolBar") or Instance.new("ScreenGui", playerGui)
46+
47
function getMagnitudeXZ(velocity)
48-
		local slot = Instance.new("ImageLabel", gui)
48+
49-
		slot.Position = position
49+
50-
		slot.Size = UDim2.new(0, 32, 0, 32)
50+
51-
		slot.BackgroundTransparency = 1
51+
52-
		slot.ImageTransparency = 0
52+
53-
		slot.Image = image
53+
54-
		slot.ZIndex = 2
54+
55
	blockPlaced.CFrame = cFPos
56
	putTexture(blockPlaced, block.frontTex, block.backTex, 
57
		block.topTex, block.bottomTex, block.leftTex, block.rightTex, "Texture")
58
	return blockPlaced
59
end
60
local toolBar = {
61
	Dirt = {
62
		size = Vector3.new(2.6, 2.6, 2.6),
63
		frontTex = "rbxassetid://179655033",
64
		backTex = "rbxassetid://179655033",
65
		topTex = "rbxassetid://179655033",
66
		bottomTex = "rbxassetid://179655033",
67
		leftTex = "rbxassetid://179655033",
68
		rightTex = "rbxassetid://179655033"
69
	},
70
	Grass = {
71
		size = Vector3.new(2.6, 2.6, 2.6),
72
		frontTex = "rbxassetid://96430337",
73
		backTex = "rbxassetid://96430337",
74
		topTex = "rbxassetid://96430265",
75
		bottomTex = "rbxassetid://179655033",
76
		leftTex = "rbxassetid://96430337",
77
		rightTex = "rbxassetid://96430337"
78
	},
79
	Stone = {
80
		size = Vector3.new(2.6, 2.6, 2.6),
81
		frontTex = "rbxassetid://75880927",
82
		backTex = "rbxassetid://75880927",
83
		topTex = "rbxassetid://75880927",
84
		bottomTex = "rbxassetid://75880927",
85
		leftTex = "rbxassetid://75880927",
86
		rightTex = "rbxassetid://75880927"
87
	},
88
	Diamond_Ore = {
89
		size = Vector3.new(2.6, 2.6, 2.6),
90
		frontTex = "rbxassetid://57928490",
91
		backTex = "rbxassetid://57928490",
92
		topTex = "rbxassetid://57928490",
93-
  	end
93+
94
		leftTex = "rbxassetid://57928490",
95
		rightTex = "rbxassetid://57928490"
96
	},
97
	Diamond_Block = {
98
		size = Vector3.new(2.6, 2.6, 2.6),
99
		frontTex = "rbxassetid://56749955",
100
		backTex = "rbxassetid://56749955",
101
		topTex = "rbxassetid://56749955",
102
		bottomTex = "rbxassetid://56749955",
103
		leftTex = "rbxassetid://56749955",
104
		rightTex = "rbxassetid://56749955"
105
	},
106
	Wood_Planks = {
107
		size = Vector3.new(2.6, 2.6, 2.6),
108
		frontTex = "rbxassetid://346201871",
109
		backTex = "rbxassetid://346201871",
110
		topTex = "rbxassetid://346201871",
111
		bottomTex = "rbxassetid://346201871",
112
		leftTex = "rbxassetid://346201871",
113
		rightTex = "rbxassetid://346201871"
114
	},
115
	Oak_Log = {
116
		size = Vector3.new(2.6, 2.6, 2.6),
117
		frontTex = "rbxassetid://310831812",
118
		backTex = "rbxassetid://310831812",
119
		topTex = "rbxassetid://152538557",
120
		bottomTex = "rbxassetid://152538557",
121
		leftTex = "rbxassetid://310831812",
122
		rightTex = "rbxassetid://310831812"
123
	}
124
}
125
if player then
126
	local char = player.Character
127
	if char then
128
		for _,cM in pairs(char:GetChildren()) do
129
			if cM.ClassName == "CharacterMesh" then cM:Destroy() end
130
		end
131
		
132
		--[]
133
		local gui = player.PlayerGui:FindFirstChild("ToolBar") or Instance.new("ScreenGui", player.PlayerGui)
134
		gui.Name = "ToolBar"
135
		
136
		makeSquare(UDim2.new(0.5, -166, 1, -111), UDim2.new(0, 364, 0, 44), 
137
			Color3.new(0/255, 0/255, 0/255), 0, gui)
138
		
139
		local blocks = {"Dirt", "Grass", "Stone", "Diamond_Ore", "Diamond_Block", "Wood_Planks", "Oak_Log"}
140
		for i = 1, 9 do
141
			if toolBar[blocks[i]] ~= nil then
142
				putToolBarSlot(UDim2.new(0.5, -160 + ((i-1)*40), 1, -105), toolBar[blocks[i]].frontTex)
143
			else
144
				putToolBarSlot(UDim2.new(0.5, -160 + ((i-1)*40), 1, -105), "")				
145
			end
146
		end	
147
		
148
		local humRootPart = char:WaitForChild("HumanoidRootPart")
149
		local head = char:WaitForChild("Head")
150
		local torso = char:WaitForChild("Torso")
151
		local lArm = char:WaitForChild("Left Arm")
152
		local rArm = char:WaitForChild("Right Arm")
153
		local lLeg = char:WaitForChild("Left Leg")
154
		local rLeg = char:WaitForChild("Right Leg")
155
		
156
		head.Size = Vector3.new(1.3, 1.3, 1.3)
157
		putTexture(head, "rbxassetid://38738031", "rbxassetid://36047330", 
158
			"rbxassetid://36047341", "rbxassetid://36047347",
159
			"rbxassetid://36047323", "rbxassetid://36047315", "Decal")
160
		head:WaitForChild("Mesh"):Destroy()
161
		head:WaitForChild("face"):Destroy()
162
		
163
		torso.Size = Vector3.new(1.3, 1.95, 0.65)
164
		putTexture(torso, "rbxassetid://38934753", "rbxassetid://38934731", 
165
			"rbxassetid://38934780", "rbxassetid://38934740",
166
			"rbxassetid://38934762", "rbxassetid://38934762", "Decal")
167
		
168
		lArm.Size = Vector3.new(0.65, 1.95, 0.65)
169
		putTexture(lArm, "rbxassetid://38934581", "rbxassetid://38934560", 
170
			"rbxassetid://38934613", "rbxassetid://38934568",
171
			"rbxassetid://38934601", "rbxassetid://38934591", "Decal")
172
		
173
		rArm.Size = Vector3.new(0.65, 1.95, 0.65)
174
		putTexture(rArm, "rbxassetid://38934560", "rbxassetid://38934581", 
175
			"rbxassetid://38934613", "rbxassetid://38934568",
176
			"rbxassetid://38934601", "rbxassetid://38934591", "Decal")
177
		
178
		lLeg.Size = Vector3.new(0.65, 1.95, 0.65)
179
		putTexture(lLeg, "rbxassetid://38936226", "rbxassetid://38936209", 
180
			"rbxassetid://38934719", "rbxassetid://38934712",
181
			"rbxassetid://38936255", "rbxassetid://38936242", "Decal")
182
		
183
		rLeg.Size = Vector3.new(0.65, 1.95, 0.65)
184
		putTexture(rLeg, "rbxassetid://38936209", "rbxassetid://38936226", 
185
			"rbxassetid://38934719", "rbxassetid://38934712",
186
			"rbxassetid://38936242", "rbxassetid://38936255", "Decal")
187
		
188
		char.Humanoid:ClearAllChildren()
189
		char.Animate:Remove()		
190
		
191
		-- now for the real stuff
192
		-- |
193
		-- |
194
		-- V
195
		Instance.new("BlockMesh", torso)
196
		Instance.new("BlockMesh", lArm)
197
		Instance.new("BlockMesh", rArm)
198
		Instance.new("BlockMesh", lLeg)
199
		Instance.new("BlockMesh", rLeg)
200
		
201
		local camera = workspace.Camera
202
		local camPart = Instance.new("Part", camera)
203
		camPart.Size = Vector3.new(0, 0, 0)
204
		camPart.CFrame = camera.CFrame
205
		camPart.Transparency = 1
206
		
207
		--[[local cameraHand = Instance.new("Part", camera)
208
		cameraHand.Size = Vector3.new(0.65, 1.95, 0.65)
209
		cameraHand.CanCollide = false
210
		cameraHand.Anchored = true
211
		cameraHand.Name = "CameraHand"
212
		putTexture(cameraHand, "rbxassetid://38934560", "rbxassetid://38934581", 
213
			"rbxassetid://38934613", "rbxassetid://38934568",
214
			"rbxassetid://38934601", "rbxassetid://38934591", "Decal")
215
		
216
		local cameraHandWeld = Instance.new("Motor6D", camPart)
217
		cameraHandWeld.Part0 = camPart
218
		cameraHandWeld.Part1 = cameraHand
219
		cameraHandWeld.C0 = CFrame.new(5, 0, 0)
220
		]]--
221
		
222
		local humanoid = char:WaitForChild("Humanoid")	
223
		humanoid.HipHeight = 0.3	
224
225
		local rootJoint = Instance.new("Motor6D", torso)
226
		rootJoint.Name = "RootJoint"
227
		rootJoint.Part0 = humRootPart
228
		rootJoint.Part1 = torso
229
		rootJoint.C1 = CFrame.new(0, 0.05, 0)
230
		
231
		local neck = Instance.new("Motor6D", torso)
232
		neck.Name = "Neck"
233
		neck.Part0 = head
234
		neck.Part1 = torso
235
		
236
		local lS = Instance.new("Motor6D", torso)
237
		lS.Name = "Left Shoulder"
238
		lS.Part0 = lArm
239
		lS.Part1 = torso
240
		lS.C0 = CFrame.new(-0.325, 0.975, 0) * CFrame.Angles(0, 0, 0)
241
		lS.C1 = CFrame.new(0.65, 0.975, 0)
242
243
		local rS = Instance.new("Motor6D", torso)
244
		rS.Name = "Right Shoulder"
245
		rS.Part0 = rArm
246
		rS.Part1 = torso
247
		rS.C0 = CFrame.new(-0.325, 0.975, 0) * CFrame.Angles(0, 0, 0)
248
		rS.C1 = CFrame.new(-0.65, 0.975, 0) * CFrame.Angles(0, -math.rad(180), 0)
249
250
		local lH = Instance.new("Motor6D", torso)
251
		lH.Name = "Left Hip"
252
		lH.Part0 = lLeg
253
		lH.Part1 = torso
254
		lH.C0 = CFrame.new(0, 0.975, 0)
255
		lH.C1 = CFrame.new(0.325, -0.975, 0) * CFrame.Angles(0, 0, 0)
256
257
		local rH = Instance.new("Motor6D", torso)
258
		rH.Name = "Right Hip"
259
		rH.Part0 = rLeg
260
		rH.Part1 = torso
261
		rH.C0 = CFrame.new(0, 0.975, 0)
262
		rH.C1 = CFrame.new(-0.325, -0.975, 0) * CFrame.Angles(0, -math.rad(180), 0)
263
		
264
		for _,p in pairs(char:GetChildren()) do
265
			if p.Name ~= "HumanoidRootPart" and p.ClassName == "Part" then
266
				local hit = Instance.new("Part", char)
267
				hit.Name = "DamagePart"
268
				hit.BrickColor = BrickColor.new("Bright red")
269
				hit.Material = "SmoothPlastic"
270
				hit.Transparency = 1
271
				hit.Size = Vector3.new(p.Size.X + 0.05, p.Size.Y + 0.05, p.Size.Z + 0.05)
272
				hit.CanCollide = false
273
				weldTo(hit, p)
274
			end
275
		end
276
		
277
		local ticks = 0
278
		local times = 0
279
		
280
		local walkAnim = 0
281
		local increaseWalkAnim = 1
282
		
283
		local idleAnimRotX = 0
284
		local idleAnimRotZ = 0
285
		local sneaking = 0
286
		
287
		local RS = game:GetService("RunService").RenderStepped
288
		local Mouse = player:GetMouse()		
289
		
290
		local oldHP = humanoid.Health
291
		local damageTime = 0
292
		
293
		local punchRotX = 0
294
		local punchRotY = 0
295
		local punchRotZ = 0			
296
		local punchSpeed = 0
297
		local punching = 0
298
		local selectedBlock = 8
299
		local punchEnded = 1
300
		local itemOnHand = nil
301
		
302
		local handItem = Instance.new("Part", char)
303
		handItem.Name = "HandItem"
304
		handItem.Size = Vector3.new(0.52, 0.52, 0.52)
305
		handItem.Transparency = 1	
306
		handItem.CanCollide = false
307
		
308
		local handItemWeld = Instance.new("Weld", char)
309
		handItemWeld.Part0 = handItem
310
		handItemWeld.Part1 = lArm
311
		handItemWeld.C1 = CFrame.new(0, -0.9, -0.6) * CFrame.Angles(math.rad(-10), math.rad(45), 0)	
312
		
313
		local sound = Instance.new("Sound", char)
314
		sound.Name = "Hurt"
315
		sound.Volume = 10
316
		sound.SoundId = "rbxassetid://535690488"		
317
		
318
		local facesToResize = {"Front", "Back", "Left", "Right", "Bottom", "Top"}
319
		Mouse.Button1Down:connect(function()
320
			if punchEnded == 1 then punching = 1 end
321
			if Mouse.Target then
322
				if getDistance(head.CFrame.p, Mouse.Hit.p) <= 10.4 then
323
					local humanoid = Mouse.Target.Parent:FindFirstChild("Humanoid")
324
					if humanoid then
325
						humanoid.Health = humanoid.Health - 10
326
						local parts = Mouse.Target.Parent:GetChildren()
327
						for _,p in pairs(parts) do
328
							if p.ClassName == "Part" then
329
								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))
330
							end
331
						end
332
						return
333
					end
334
					local x = Mouse.Target.CFrame.p.X
335
					local y = Mouse.Target.CFrame.p.Y
336
					local z = Mouse.Target.CFrame.p.Z
337
					if Mouse.TargetSurface.Name == "Right" then x = x + 2.6 end
338
					if Mouse.TargetSurface.Name == "Left" then x = x - 2.6 end
339
					if Mouse.TargetSurface.Name == "Top" then y = y + 2.6 end
340
					if Mouse.TargetSurface.Name == "Bottom" then y = y - 2.6 end
341
					if Mouse.TargetSurface.Name == "Back" then z = z + 2.6 end
342
					if Mouse.TargetSurface.Name == "Front" then z = z - 2.6 end
343
					if Mouse.Target.Size.X > 2.6 or Mouse.Target.Size.Y > 2.6 or Mouse.Target.Size.Z > 2.6 then
344
						x = Mouse.Hit.p.X
345
						y = Mouse.Hit.p.Y
346
						z = Mouse.Hit.p.Z
347
					end
348
	--				local x = round(math.abs(mouseX)/2.6)*2.6
349
	--				local y = round(math.abs(mouseY)/2.6)*2.6
350
	--				local z = round(math.abs(mouseZ)/2.6)*2.6
351
	--				if Mouse.Hit.p.X < 0 then x = x * -1 end
352
	--				if Mouse.Hit.p.Y < 0 then y = y * -1 end
353
	--				if Mouse.Hit.p.Z < 0 then z = z * -1 end
354
					if selectedBlock == 0 then
355
						local blk = placeBlock(toolBar.Dirt, CFrame.new(x, y, z))
356
						for _,f in pairs(facesToResize) do
357
							blk:WaitForChild(f).StudsPerTileU = 2.6
358
							blk:WaitForChild(f).StudsPerTileV = 2.6
359
						end
360
					elseif selectedBlock == 1 then
361
						local blk = placeBlock(toolBar.Grass, CFrame.new(x, y, z))
362
						for _,f in pairs(facesToResize) do
363
							blk:WaitForChild(f).StudsPerTileU = 2.6
364
							blk:WaitForChild(f).StudsPerTileV = 2.6
365
						end
366
					elseif selectedBlock == 2 then
367
						local blk = placeBlock(toolBar.Stone, CFrame.new(x, y, z))
368
						for _,f in pairs(facesToResize) do
369
							blk:WaitForChild(f).StudsPerTileU = 2.6
370
							blk:WaitForChild(f).StudsPerTileV = 2.6
371
						end
372
					elseif selectedBlock == 3 then
373
						local blk = placeBlock(toolBar.Diamond_Ore, CFrame.new(x, y, z))
374
						for _,f in pairs(facesToResize) do
375
							blk:WaitForChild(f).StudsPerTileU = 2.6
376
							blk:WaitForChild(f).StudsPerTileV = 2.6
377
						end
378
					elseif selectedBlock == 4 then
379
						local blk = placeBlock(toolBar.Diamond_Block, CFrame.new(x, y, z))
380
						for _,f in pairs(facesToResize) do
381
							blk:WaitForChild(f).StudsPerTileU = 2.6
382
							blk:WaitForChild(f).StudsPerTileV = 2.6
383
						end
384
					elseif selectedBlock == 5 then
385
						local blk = placeBlock(toolBar.Wood_Planks, CFrame.new(x, y, z))
386
						for _,f in pairs(facesToResize) do
387
							blk:WaitForChild(f).StudsPerTileU = 2.6
388
							blk:WaitForChild(f).StudsPerTileV = 2.6
389
						end
390
					elseif selectedBlock == 6 then
391
						local blk = placeBlock(toolBar.Oak_Log, CFrame.new(x, y, z))
392
						for _,f in pairs(facesToResize) do
393
							blk:WaitForChild(f).StudsPerTileU = 2.6
394
							blk:WaitForChild(f).StudsPerTileV = 2.6
395
						end
396
					elseif selectedBlock == 7 or selectedBlock == 8 then
397
						if Mouse.Target.Size.X <= 10 and Mouse.Target.Size.Y <= 10 and Mouse.Target.Size.Z <= 10 then
398
							Mouse.Target.Parent = nil
399
						end
400
					end
401
				end
402
			end
403
		end)		
404
		
405
		local hasItemOnHand = 0
406
		local hi = 0
407
		-- selection thingy
408
		local selectLabel = Instance.new("TextLabel", gui)
409
		selectLabel.Size = UDim2.new(0, 32, 0, 32)
410
		selectLabel.Position = UDim2.new(0.5, -160 + (selectedBlock*40), 1, -105)
411
		selectLabel.BackgroundTransparency = 0.5
412
		selectLabel.BackgroundColor3 = Color3.new(1, 1, 1)
413
		selectLabel.BorderSizePixel = 0
414
		selectLabel.Text = ""
415
		selectLabel.ZIndex = 3
416
		--	
417
		Mouse.KeyDown:connect(function(key)
418
			if key == "q" then
419
				sneaking = 1
420
				humanoid.WalkSpeed = humanoid.WalkSpeed / 2
421
				rootJoint.C1 = CFrame.new(0, 0.325, 0) * CFrame.Angles(math.rad(sneaking*45), 0, 0)
422
				lH.C0 = CFrame.new(0, 0.975, 0) * CFrame.Angles(-math.rad(sneaking*45), 0, 0)
423
				rH.C0 = CFrame.new(0, 0.975, 0) * CFrame.Angles(math.rad(sneaking*45), 0, 0)
424
				--print("Sneaking...")
425
			end
426
			if key == "8" then 
427
				selectedBlock = 7
428
				itemOnHand = nil
429
				for _,d in pairs(handItem:GetChildren()) do
430
					d:Destroy()
431
				end
432
				if hasItemOnHand == 1 then hi = 1 end
433
			end
434
			if key == "9" then 
435
				selectedBlock = 8
436
				itemOnHand = nil
437
				for _,d in pairs(handItem:GetChildren()) do
438
					d:Destroy()
439
				end
440
				if hasItemOnHand == 1 then hi = 1 end
441
			end
442
			if key == "1" then 
443
				selectedBlock = 0
444
				itemOnHand = toolBar.Dirt
445
				for _,d in pairs(handItem:GetChildren()) do
446
					d:Destroy()
447
				end
448
				putTexture(handItem, itemOnHand.frontTex, itemOnHand.backTex,
449
					itemOnHand.topTex, itemOnHand.bottomTex,
450
					itemOnHand.leftTex, itemOnHand.rightTex, "Texture")
451
				for _,f in pairs(facesToResize) do
452
					handItem:WaitForChild(f).StudsPerTileU = 0.52
453
					handItem:WaitForChild(f).StudsPerTileV = 0.52
454
				end
455
			end
456
			if key == "2" then 
457
				selectedBlock = 1 
458
				itemOnHand = toolBar.Grass
459
				for _,d in pairs(handItem:GetChildren()) do
460
					d:Destroy()
461
				end
462
				putTexture(handItem, itemOnHand.frontTex, itemOnHand.backTex,
463
					itemOnHand.topTex, itemOnHand.bottomTex,
464
					itemOnHand.leftTex, itemOnHand.rightTex, "Texture")
465
				for _,f in pairs(facesToResize) do
466
					handItem:WaitForChild(f).StudsPerTileU = 0.52
467
					handItem:WaitForChild(f).StudsPerTileV = 0.52
468
				end
469
			end
470
			if key == "3" then 
471
				selectedBlock = 2 
472
				itemOnHand = toolBar.Stone
473
				for _,d in pairs(handItem:GetChildren()) do
474
					d:Destroy()
475
				end
476
				putTexture(handItem, itemOnHand.frontTex, itemOnHand.backTex,
477
					itemOnHand.topTex, itemOnHand.bottomTex,
478
					itemOnHand.leftTex, itemOnHand.rightTex, "Texture")
479
				for _,f in pairs(facesToResize) do
480
					handItem:WaitForChild(f).StudsPerTileU = 0.52
481
					handItem:WaitForChild(f).StudsPerTileV = 0.52
482
				end
483
			end
484
			if key == "4" then 
485
				selectedBlock = 3 
486
				itemOnHand = toolBar.Diamond_Ore
487
				for _,d in pairs(handItem:GetChildren()) do
488
					d:Destroy()
489
				end
490
				putTexture(handItem, itemOnHand.frontTex, itemOnHand.backTex,
491
					itemOnHand.topTex, itemOnHand.bottomTex,
492
					itemOnHand.leftTex, itemOnHand.rightTex, "Texture")
493
				for _,f in pairs(facesToResize) do
494
					handItem:WaitForChild(f).StudsPerTileU = 0.52
495
					handItem:WaitForChild(f).StudsPerTileV = 0.52
496
				end
497
			end
498
			if key == "5" then 
499
				selectedBlock = 4 
500
				itemOnHand = toolBar.Diamond_Block
501
				for _,d in pairs(handItem:GetChildren()) do
502
					d:Destroy()
503
				end
504
				putTexture(handItem, itemOnHand.frontTex, itemOnHand.backTex,
505
					itemOnHand.topTex, itemOnHand.bottomTex,
506
					itemOnHand.leftTex, itemOnHand.rightTex, "Texture")
507
				for _,f in pairs(facesToResize) do
508
					handItem:WaitForChild(f).StudsPerTileU = 0.52
509
					handItem:WaitForChild(f).StudsPerTileV = 0.52
510
				end
511
			end
512
			if key == "6" then 
513
				selectedBlock = 5 
514
				itemOnHand = toolBar.Wood_Planks
515
				for _,d in pairs(handItem:GetChildren()) do
516
					d:Destroy()
517
				end
518
				putTexture(handItem, itemOnHand.frontTex, itemOnHand.backTex,
519
					itemOnHand.topTex, itemOnHand.bottomTex,
520
					itemOnHand.leftTex, itemOnHand.rightTex, "Texture")
521
				for _,f in pairs(facesToResize) do
522
					handItem:WaitForChild(f).StudsPerTileU = 0.52
523
					handItem:WaitForChild(f).StudsPerTileV = 0.52
524
				end
525
			end
526
			if key == "7" then 
527
				selectedBlock = 6 
528
				itemOnHand = toolBar.Oak_Log
529
				for _,d in pairs(handItem:GetChildren()) do
530
					d:Destroy()
531
				end
532
				putTexture(handItem, itemOnHand.frontTex, itemOnHand.backTex,
533
					itemOnHand.topTex, itemOnHand.bottomTex,
534
					itemOnHand.leftTex, itemOnHand.rightTex, "Texture")
535
				for _,f in pairs(facesToResize) do
536
					handItem:WaitForChild(f).StudsPerTileU = 0.52
537
					handItem:WaitForChild(f).StudsPerTileV = 0.52
538
				end
539
			end
540
			if (key == "0" or key == "1" or key == "2" 
541
				or key == "3" or key == "4" or key == "5"
542
				or key == "6" or key == "7") and hasItemOnHand == 0 then hi = 1 end
543
			selectLabel.Position = UDim2.new(0.5, -160 + ((selectedBlock)*40), 1, -105)
544
		end)
545
		
546
		Mouse.KeyUp:connect(function(key)
547
			if key == "q" then
548
				sneaking = 0
549
				humanoid.WalkSpeed = humanoid.WalkSpeed * 2
550
				rootJoint.C1 = CFrame.new(0, 0.05, 0) * CFrame.Angles(0, 0, 0)
551
				lH.C0 = CFrame.new(0, 0.975, 0) * CFrame.Angles(0, 0, 0)
552
				rH.C0 = CFrame.new(0, 0.975, 0) * CFrame.Angles(0, 0, 0)
553
				--print("Stopped sneaking...")
554
			end
555
		end)
556
		
557
		while RS:wait() do
558
			if itemOnHand ~= nil then 
559
				hasItemOnHand = 1 
560
				handItem.Transparency = 0
561
			else 
562
				hasItemOnHand = 0 
563
				handItem.Transparency = 1
564
			end
565
			if humanoid.Health < oldHP then
566
				damageTime = 60
567
				sound:Play()
568
			end
569
			oldHP = humanoid.Health
570
			if damageTime > 0 and humanoid.Health > 0 then
571
				for _,p in pairs(char:GetChildren()) do
572
					if p.Name ~= "HumanoidRootPart" and p.ClassName == "Part" then
573
						if p.Name == "DamagePart" then
574
							p.Transparency = 0.5
575
						end
576
					end
577
				end
578
				damageTime = damageTime - 2
579
				if damageTime <= 0 then
580
					for _,p in pairs(char:GetChildren()) do
581
						if p.Name ~= "HumanoidRootPart" and p.ClassName == "Part" then
582
							if p.Name == "DamagePart" then
583
								p.Transparency = 1
584
							end
585
						end
586
					end
587
				end
588
			end
589
			camPart.CFrame = camera.CFrame
590
			neck.C1 = CFrame.new(0, 0.975, 0) * CFrame.fromEulerAnglesXYZ(math.rad(sneaking*45), math.rad(camPart.Orientation.Y - torso.Orientation.Y), 0)
591
			neck.C0 = CFrame.new(0, -0.65, 0) * CFrame.Angles(-math.rad(camPart.Orientation.X - torso.Orientation.X - (sneaking*45)), 0, 0)		
592
			
593
			if getMagnitudeXZ(torso.Velocity) > 1 then
594
				if walkAnim >= 1 then
595
					increaseWalkAnim = -1
596
				elseif walkAnim <= -1 then
597
					increaseWalkAnim = 1
598
				end
599
				walkAnim = walkAnim + (increaseWalkAnim/(10+(sneaking*20)))
600
			else
601
				walkAnim = 0
602
			end
603
			
604
			--lH.C0 = CFrame.new(0, 0.975, 0) * CFrame.Angles(-math.rad(sneaking*45), 0, 0)
605
			--rH.C0 = CFrame.new(0, 0.975, 0) * CFrame.Angles(math.rad(sneaking*45), 0, 0)
606
			lH.C0 = lH.C0:lerp(CFrame.new(0, 0.975, 0) * CFrame.Angles(-math.rad(sneaking*45) + math.rad(damageTime*1.5) + math.rad(walkAnim*getMagnitudeXZ(torso.Velocity)*5/(1+sneaking)), 0, 0), 0.1)
607
	    	rH.C0 = rH.C0:lerp(CFrame.new(0, 0.975, 0) * CFrame.Angles(math.rad(sneaking*45) + math.rad(damageTime*1.5) + math.rad(walkAnim*getMagnitudeXZ(torso.Velocity)*5/(1+sneaking)), 0, 0), 0.1)
608
			--
609
			--rootJoint.C0 = CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0)
610
			--print(math.abs(head.Orientation.Y) - math.abs(humRootPart.Orientation.Y))
611
			--if (head.Orientation.Y * 2) - (head.Orientation.Y + torso.Orientation.Y) > 45 then
612
				--humRootPart.CFrame = humRootPart.CFrame * CFrame.Angles(0, math.rad(-45 + head.Orientation.Y), 0)
613
				--print("-45")
614
			--end
615
			--if (head.Orientation.Y * 2) - (head.Orientation.Y + torso.Orientation.Y) < -45 then
616
				--humRootPart.CFrame = humRootPart.CFrame * CFrame.Angles(0, math.rad(45 + head.Orientation.Y), 0)
617
				--print("45")
618
			--end
619
			
620
			--move these arms
621
			rootJoint.C1 = rootJoint.C1:lerp(CFrame.new(0, 0.325, 0) * CFrame.Angles(math.rad(sneaking*45), math.rad(punchRotY), 0), 0.2)
622
			
623
	    	lS.C0 = lS.C0:lerp(CFrame.new(-0.325, 0.975, 0) * CFrame.Angles(idleAnimRotX/20 + math.rad(-hasItemOnHand*10) + math.rad(punchRotX) + math.rad(damageTime*1.5) + math.rad(walkAnim*getMagnitudeXZ(torso.Velocity)*5/(1+sneaking)), 0, math.rad(punchRotZ) + idleAnimRotZ/20), 0.025+(math.min(1, getMagnitudeXZ(torso.Velocity))/12) + divide(punchSpeed, 6) + hi)
624
	    	rS.C0 = rS.C0:lerp(CFrame.new(-0.325, 0.975, 0) * CFrame.Angles(idleAnimRotX/20 + math.rad(damageTime*1.5) + math.rad(walkAnim*getMagnitudeXZ(torso.Velocity)*5/(1+sneaking)), 0, idleAnimRotZ/20), 0.025+(math.min(1, getMagnitudeXZ(torso.Velocity))/12))
625
			if punching == 1 and punchEnded == 1 then
626
				punching = 0
627
				--print("steve uses punch!!")
628
				local coPunch = coroutine.wrap(function()
629
					punchEnded = 0
630
					punchSpeed = 1
631
					punchRotX = -60
632
					punchRotY = -8
633
					punchRotZ = -35
634
					wait(0.075)
635
					punchSpeed = 1
636
					punchRotX = -75
637
					punchRotY = 8
638
					punchRotZ = 40
639
					wait(0.075)
640
					punchSpeed = 1
641
					punchRotX = -20
642
					punchRotZ = 40
643
					wait(0.075)
644
					punchSpeed = 3.5
645
					punchRotX = 0
646
					punchRotY = 0
647
					punchRotZ = 0
648
					punchEnded = 1
649
					wait(0.06)	
650
					punchSpeed = 0			
651
				end)
652
				coPunch()
653
			end			
654
			if ticks > 20 then
655
				ticks = 0
656
				if times == 0 then
657
					times = times + 1
658
					idleAnimRotX = -1
659
					idleAnimRotZ = 0
660
				elseif times == 1 then
661
					times = times + 1
662
					idleAnimRotX = -0.75
663
					idleAnimRotZ = -0.75
664
				elseif times == 2 then
665
					times = times + 1
666
					idleAnimRotX = 0
667
					idleAnimRotZ = -1
668
				elseif times == 3 then
669
					times = times + 1
670
					idleAnimRotX = 0.75
671
					idleAnimRotZ = -0.75
672
					--idleAnimRotX = 0.75
673
					--idleAnimRotZ = -0
674
				elseif times == 4 then
675
					times = times + 1
676
					idleAnimRotX = 1
677
					idleAnimRotZ = 0
678
					--idleAnimRotX = 1
679
					--idleAnimRotZ = 0
680
				elseif times == 5 then
681
					times = times + 1
682
					idleAnimRotX = 0.75
683
					idleAnimRotZ = 0.75
684
				elseif times == 6 then
685
					times = times + 1
686
					idleAnimRotX = 0
687
					idleAnimRotZ = 1
688
				elseif times == 7 then
689
					times = 0
690
					idleAnimRotX = -0.75
691
					idleAnimRotZ = 0.75
692
				end
693
			end
694
			if hi == 1 then hi = 0 end
695
			ticks = ticks + 1
696
		end
697
	end
698
end