danielaust

minecrfaft

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