Advertisement
Guest User

lol

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