PasterXIV

Untitled

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