Elvisfofo_rblx

Steve

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