Advertisement
ManlyMemeScripter

MineDiamonds

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