r16

Untitled

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