Advertisement
1nubloku

mine2

Sep 16th, 2019
129
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 RS = Stepped
  428.  
  429. local oldHP = humanoid.Health
  430. local damageTime = 0
  431.  
  432. local punchRotX = 0
  433. local punchRotY = 0
  434. local punchRotZ = 0
  435. local punchSpeed = 0
  436. local punching = 0
  437. local selectedBlock = 8
  438. local punchEnded = 1
  439. local itemOnHand = nil
  440.  
  441. local handItem = Instance.new("Part", char)
  442. handItem.Name = "HandItem"
  443. handItem.Size = Vector3.new(0.52, 0.52, 0.52)
  444. handItem.Transparency = 1
  445. handItem.CanCollide = false
  446.  
  447. local handItemWeld = Instance.new("Weld", char)
  448. handItemWeld.Part0 = handItem
  449. handItemWeld.Part1 = lArm
  450. handItemWeld.C1 = CFrame.new(0, -0.9, -0.6) * CFrame.Angles(math.rad(-10), math.rad(45), 0)
  451.  
  452. local sound = Instance.new("Sound", char)
  453. sound.Name = "Hurt"
  454. sound.Volume = 10
  455. sound.SoundId = "rbxassetid://535690488"
  456.  
  457. local facesToResize = {"Front", "Back", "Left", "Right", "Bottom", "Top"}
  458. Mouse.Button1Down:connect(function()
  459. if punchEnded == 1 then punching = 1 end
  460. if Mouse.Target then
  461. if getDistance(head.CFrame.p, Mouse.Hit.p) <= 10.4 then
  462. local humanoid = Mouse.Target.Parent:FindFirstChild("Humanoid")
  463. if humanoid then
  464. humanoid.Health = humanoid.Health - 10
  465. local parts = Mouse.Target.Parent:GetChildren()
  466. for _,p in pairs(parts) do
  467. if p.ClassName == "Part" then
  468. 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))
  469. end
  470. end
  471. return
  472. end
  473. local x = Mouse.Target.CFrame.p.X
  474. local y = Mouse.Target.CFrame.p.Y
  475. local z = Mouse.Target.CFrame.p.Z
  476. if Mouse.TargetSurface.Name == "Right" then x = x + 2.6 end
  477. if Mouse.TargetSurface.Name == "Left" then x = x - 2.6 end
  478. if Mouse.TargetSurface.Name == "Top" then y = y + 2.6 end
  479. if Mouse.TargetSurface.Name == "Bottom" then y = y - 2.6 end
  480. if Mouse.TargetSurface.Name == "Back" then z = z + 2.6 end
  481. if Mouse.TargetSurface.Name == "Front" then z = z - 2.6 end
  482. if Mouse.Target.Size.X > 2.6 or Mouse.Target.Size.Y > 2.6 or Mouse.Target.Size.Z > 2.6 then
  483. x = Mouse.Hit.p.X
  484. y = Mouse.Hit.p.Y
  485. z = Mouse.Hit.p.Z
  486. end
  487. -- local x = round(math.abs(mouseX)/2.6)*2.6
  488. -- local y = round(math.abs(mouseY)/2.6)*2.6
  489. -- local z = round(math.abs(mouseZ)/2.6)*2.6
  490. -- if Mouse.Hit.p.X < 0 then x = x * -1 end
  491. -- if Mouse.Hit.p.Y < 0 then y = y * -1 end
  492. -- if Mouse.Hit.p.Z < 0 then z = z * -1 end
  493. if selectedBlock == 0 then
  494. local blk = placeBlock(toolBar.Dirt, CFrame.new(x, y, z))
  495. for _,f in pairs(facesToResize) do
  496. blk:WaitForChild(f).StudsPerTileU = 2.6
  497. blk:WaitForChild(f).StudsPerTileV = 2.6
  498. end
  499. elseif selectedBlock == 1 then
  500. local blk = placeBlock(toolBar.Grass, CFrame.new(x, y, z))
  501. for _,f in pairs(facesToResize) do
  502. blk:WaitForChild(f).StudsPerTileU = 2.6
  503. blk:WaitForChild(f).StudsPerTileV = 2.6
  504. end
  505. elseif selectedBlock == 2 then
  506. local blk = placeBlock(toolBar.Stone, CFrame.new(x, y, z))
  507. for _,f in pairs(facesToResize) do
  508. blk:WaitForChild(f).StudsPerTileU = 2.6
  509. blk:WaitForChild(f).StudsPerTileV = 2.6
  510. end
  511. elseif selectedBlock == 3 then
  512. local blk = placeBlock(toolBar.Diamond_Ore, CFrame.new(x, y, z))
  513. for _,f in pairs(facesToResize) do
  514. blk:WaitForChild(f).StudsPerTileU = 2.6
  515. blk:WaitForChild(f).StudsPerTileV = 2.6
  516. end
  517. elseif selectedBlock == 4 then
  518. local blk = placeBlock(toolBar.Diamond_Block, CFrame.new(x, y, z))
  519. for _,f in pairs(facesToResize) do
  520. blk:WaitForChild(f).StudsPerTileU = 2.6
  521. blk:WaitForChild(f).StudsPerTileV = 2.6
  522. end
  523. elseif selectedBlock == 5 then
  524. local blk = placeBlock(toolBar.Wood_Planks, CFrame.new(x, y, z))
  525. for _,f in pairs(facesToResize) do
  526. blk:WaitForChild(f).StudsPerTileU = 2.6
  527. blk:WaitForChild(f).StudsPerTileV = 2.6
  528. end
  529. elseif selectedBlock == 6 then
  530. local blk = placeBlock(toolBar.Oak_Log, CFrame.new(x, y, z))
  531. for _,f in pairs(facesToResize) do
  532. blk:WaitForChild(f).StudsPerTileU = 2.6
  533. blk:WaitForChild(f).StudsPerTileV = 2.6
  534. end
  535. elseif selectedBlock == 7 or selectedBlock == 8 then
  536. if Mouse.Target.Size.X <= 10 and Mouse.Target.Size.Y <= 10 and Mouse.Target.Size.Z <= 10 then
  537. Mouse.Target.Parent = nil
  538. end
  539. end
  540. end
  541. end
  542. end)
  543.  
  544. local hasItemOnHand = 0
  545. local hi = 0
  546. -- selection thingy
  547. local selectLabel = Instance.new("TextLabel", gui)
  548. selectLabel.Size = UDim2.new(0, 32, 0, 32)
  549. selectLabel.Position = UDim2.new(0.5, -160 + (selectedBlock*40), 1, -105)
  550. selectLabel.BackgroundTransparency = 0.5
  551. selectLabel.BackgroundColor3 = Color3.new(1, 1, 1)
  552. selectLabel.BorderSizePixel = 0
  553. selectLabel.Text = ""
  554. selectLabel.ZIndex = 3
  555. --
  556. Mouse.KeyDown:connect(function(key)
  557. if key == "q" then
  558. sneaking = 1
  559. humanoid.WalkSpeed = humanoid.WalkSpeed / 2
  560. rootJoint.C1 = CFrame.new(0, 0.325, 0) * CFrame.Angles(math.rad(sneaking*45), 0, 0)
  561. lH.C0 = CFrame.new(0, 0.975, 0) * CFrame.Angles(-math.rad(sneaking*45), 0, 0)
  562. rH.C0 = CFrame.new(0, 0.975, 0) * CFrame.Angles(math.rad(sneaking*45), 0, 0)
  563. --print("Sneaking...")
  564. end
  565. if key == "8" then
  566. selectedBlock = 7
  567. itemOnHand = nil
  568. for _,d in pairs(handItem:GetChildren()) do
  569. d:Destroy()
  570. end
  571. if hasItemOnHand == 1 then hi = 1 end
  572. end
  573. if key == "9" then
  574. selectedBlock = 8
  575. itemOnHand = nil
  576. for _,d in pairs(handItem:GetChildren()) do
  577. d:Destroy()
  578. end
  579. if hasItemOnHand == 1 then hi = 1 end
  580. end
  581. if key == "1" then
  582. selectedBlock = 0
  583. itemOnHand = toolBar.Dirt
  584. for _,d in pairs(handItem:GetChildren()) do
  585. d:Destroy()
  586. end
  587. putTexture(handItem, itemOnHand.frontTex, itemOnHand.backTex,
  588. itemOnHand.topTex, itemOnHand.bottomTex,
  589. itemOnHand.leftTex, itemOnHand.rightTex, "Texture")
  590. for _,f in pairs(facesToResize) do
  591. handItem:WaitForChild(f).StudsPerTileU = 0.52
  592. handItem:WaitForChild(f).StudsPerTileV = 0.52
  593. end
  594. end
  595. if key == "2" then
  596. selectedBlock = 1
  597. itemOnHand = toolBar.Grass
  598. for _,d in pairs(handItem:GetChildren()) do
  599. d:Destroy()
  600. end
  601. putTexture(handItem, itemOnHand.frontTex, itemOnHand.backTex,
  602. itemOnHand.topTex, itemOnHand.bottomTex,
  603. itemOnHand.leftTex, itemOnHand.rightTex, "Texture")
  604. for _,f in pairs(facesToResize) do
  605. handItem:WaitForChild(f).StudsPerTileU = 0.52
  606. handItem:WaitForChild(f).StudsPerTileV = 0.52
  607. end
  608. end
  609. if key == "3" then
  610. selectedBlock = 2
  611. itemOnHand = toolBar.Stone
  612. for _,d in pairs(handItem:GetChildren()) do
  613. d:Destroy()
  614. end
  615. putTexture(handItem, itemOnHand.frontTex, itemOnHand.backTex,
  616. itemOnHand.topTex, itemOnHand.bottomTex,
  617. itemOnHand.leftTex, itemOnHand.rightTex, "Texture")
  618. for _,f in pairs(facesToResize) do
  619. handItem:WaitForChild(f).StudsPerTileU = 0.52
  620. handItem:WaitForChild(f).StudsPerTileV = 0.52
  621. end
  622. end
  623. if key == "4" then
  624. selectedBlock = 3
  625. itemOnHand = toolBar.Diamond_Ore
  626. for _,d in pairs(handItem:GetChildren()) do
  627. d:Destroy()
  628. end
  629. putTexture(handItem, itemOnHand.frontTex, itemOnHand.backTex,
  630. itemOnHand.topTex, itemOnHand.bottomTex,
  631. itemOnHand.leftTex, itemOnHand.rightTex, "Texture")
  632. for _,f in pairs(facesToResize) do
  633. handItem:WaitForChild(f).StudsPerTileU = 0.52
  634. handItem:WaitForChild(f).StudsPerTileV = 0.52
  635. end
  636. end
  637. if key == "5" then
  638. selectedBlock = 4
  639. itemOnHand = toolBar.Diamond_Block
  640. for _,d in pairs(handItem:GetChildren()) do
  641. d:Destroy()
  642. end
  643. putTexture(handItem, itemOnHand.frontTex, itemOnHand.backTex,
  644. itemOnHand.topTex, itemOnHand.bottomTex,
  645. itemOnHand.leftTex, itemOnHand.rightTex, "Texture")
  646. for _,f in pairs(facesToResize) do
  647. handItem:WaitForChild(f).StudsPerTileU = 0.52
  648. handItem:WaitForChild(f).StudsPerTileV = 0.52
  649. end
  650. end
  651. if key == "6" then
  652. selectedBlock = 5
  653. itemOnHand = toolBar.Wood_Planks
  654. for _,d in pairs(handItem:GetChildren()) do
  655. d:Destroy()
  656. end
  657. putTexture(handItem, itemOnHand.frontTex, itemOnHand.backTex,
  658. itemOnHand.topTex, itemOnHand.bottomTex,
  659. itemOnHand.leftTex, itemOnHand.rightTex, "Texture")
  660. for _,f in pairs(facesToResize) do
  661. handItem:WaitForChild(f).StudsPerTileU = 0.52
  662. handItem:WaitForChild(f).StudsPerTileV = 0.52
  663. end
  664. end
  665. if key == "7" then
  666. selectedBlock = 6
  667. itemOnHand = toolBar.Oak_Log
  668. for _,d in pairs(handItem:GetChildren()) do
  669. d:Destroy()
  670. end
  671. putTexture(handItem, itemOnHand.frontTex, itemOnHand.backTex,
  672. itemOnHand.topTex, itemOnHand.bottomTex,
  673. itemOnHand.leftTex, itemOnHand.rightTex, "Texture")
  674. for _,f in pairs(facesToResize) do
  675. handItem:WaitForChild(f).StudsPerTileU = 0.52
  676. handItem:WaitForChild(f).StudsPerTileV = 0.52
  677. end
  678. end
  679. if (key == "0" or key == "1" or key == "2"
  680. or key == "3" or key == "4" or key == "5"
  681. or key == "6" or key == "7") and hasItemOnHand == 0 then hi = 1 end
  682. selectLabel.Position = UDim2.new(0.5, -160 + ((selectedBlock)*40), 1, -105)
  683. end)
  684.  
  685. Mouse.KeyUp:connect(function(key)
  686. if key == "q" then
  687. sneaking = 0
  688. humanoid.WalkSpeed = humanoid.WalkSpeed * 2
  689. rootJoint.C1 = CFrame.new(0, 0.05, 0) * CFrame.Angles(0, 0, 0)
  690. lH.C0 = CFrame.new(0, 0.975, 0) * CFrame.Angles(0, 0, 0)
  691. rH.C0 = CFrame.new(0, 0.975, 0) * CFrame.Angles(0, 0, 0)
  692. --print("Stopped sneaking...")
  693. end
  694. end)
  695.  
  696. while RS:wait() do
  697. if itemOnHand ~= nil then
  698. hasItemOnHand = 1
  699. handItem.Transparency = 0
  700. else
  701. hasItemOnHand = 0
  702. handItem.Transparency = 1
  703. end
  704. if humanoid.Health < oldHP then
  705. damageTime = 60
  706. sound:Play()
  707. end
  708. oldHP = humanoid.Health
  709. if damageTime > 0 and humanoid.Health > 0 then
  710. for _,p in pairs(char:GetChildren()) do
  711. if p.Name ~= "HumanoidRootPart" and p.ClassName == "Part" then
  712. if p.Name == "DamagePart" then
  713. p.Transparency = 0.5
  714. end
  715. end
  716. end
  717. damageTime = damageTime - 2
  718. if damageTime <= 0 then
  719. for _,p in pairs(char:GetChildren()) do
  720. if p.Name ~= "HumanoidRootPart" and p.ClassName == "Part" then
  721. if p.Name == "DamagePart" then
  722. p.Transparency = 1
  723. end
  724. end
  725. end
  726. end
  727. end
  728. camPart.CFrame = camera.CFrame
  729. neck.C1 = CFrame.new(0, 0.975, 0) * CFrame.fromEulerAnglesXYZ(math.rad(sneaking*45), math.rad(camPart.Orientation.Y - torso.Orientation.Y), 0)
  730. neck.C0 = CFrame.new(0, -0.65, 0) * CFrame.Angles(-math.rad(camPart.Orientation.X - torso.Orientation.X - (sneaking*45)), 0, 0)
  731.  
  732. if getMagnitudeXZ(torso.Velocity) > 1 then
  733. if walkAnim >= 1 then
  734. increaseWalkAnim = -1
  735. elseif walkAnim <= -1 then
  736. increaseWalkAnim = 1
  737. end
  738. walkAnim = walkAnim + (increaseWalkAnim/(10+(sneaking*20)))
  739. else
  740. walkAnim = 0
  741. end
  742.  
  743. --lH.C0 = CFrame.new(0, 0.975, 0) * CFrame.Angles(-math.rad(sneaking*45), 0, 0)
  744. --rH.C0 = CFrame.new(0, 0.975, 0) * CFrame.Angles(math.rad(sneaking*45), 0, 0)
  745. 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)
  746. 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)
  747. --
  748. --rootJoint.C0 = CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0)
  749. --print(math.abs(head.Orientation.Y) - math.abs(humRootPart.Orientation.Y))
  750. --if (head.Orientation.Y * 2) - (head.Orientation.Y + torso.Orientation.Y) > 45 then
  751. --humRootPart.CFrame = humRootPart.CFrame * CFrame.Angles(0, math.rad(-45 + head.Orientation.Y), 0)
  752. --print("-45")
  753. --end
  754. --if (head.Orientation.Y * 2) - (head.Orientation.Y + torso.Orientation.Y) < -45 then
  755. --humRootPart.CFrame = humRootPart.CFrame * CFrame.Angles(0, math.rad(45 + head.Orientation.Y), 0)
  756. --print("45")
  757. --end
  758.  
  759. --move these arms
  760. rootJoint.C1 = rootJoint.C1:lerp(CFrame.new(0, 0.325, 0) * CFrame.Angles(math.rad(sneaking*45), math.rad(punchRotY), 0), 0.2)
  761.  
  762. 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)
  763. 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))
  764. if punching == 1 and punchEnded == 1 then
  765. punching = 0
  766. --print("steve uses punch!!")
  767. local coPunch = coroutine.wrap(function()
  768. punchEnded = 0
  769. punchSpeed = 1
  770. punchRotX = -60
  771. punchRotY = -8
  772. punchRotZ = -35
  773. wait(0.075)
  774. punchSpeed = 1
  775. punchRotX = -75
  776. punchRotY = 8
  777. punchRotZ = 40
  778. wait(0.075)
  779. punchSpeed = 1
  780. punchRotX = -20
  781. punchRotZ = 40
  782. wait(0.075)
  783. punchSpeed = 3.5
  784. punchRotX = 0
  785. punchRotY = 0
  786. punchRotZ = 0
  787. punchEnded = 1
  788. wait(0.06)
  789. punchSpeed = 0
  790. end)
  791. coPunch()
  792. end
  793. if ticks > 20 then
  794. ticks = 0
  795. if times == 0 then
  796. times = times + 1
  797. idleAnimRotX = -1
  798. idleAnimRotZ = 0
  799. elseif times == 1 then
  800. times = times + 1
  801. idleAnimRotX = -0.75
  802. idleAnimRotZ = -0.75
  803. elseif times == 2 then
  804. times = times + 1
  805. idleAnimRotX = 0
  806. idleAnimRotZ = -1
  807. elseif times == 3 then
  808. times = times + 1
  809. idleAnimRotX = 0.75
  810. idleAnimRotZ = -0.75
  811. --idleAnimRotX = 0.75
  812. --idleAnimRotZ = -0
  813. elseif times == 4 then
  814. times = times + 1
  815. idleAnimRotX = 1
  816. idleAnimRotZ = 0
  817. --idleAnimRotX = 1
  818. --idleAnimRotZ = 0
  819. elseif times == 5 then
  820. times = times + 1
  821. idleAnimRotX = 0.75
  822. idleAnimRotZ = 0.75
  823. elseif times == 6 then
  824. times = times + 1
  825. idleAnimRotX = 0
  826. idleAnimRotZ = 1
  827. elseif times == 7 then
  828. times = 0
  829. idleAnimRotX = -0.75
  830. idleAnimRotZ = 0.75
  831. end
  832. end
  833. if hi == 1 then hi = 0 end
  834. ticks = ticks + 1
  835. end
  836. end
  837. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement