Advertisement
1nubloku

mine

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