Advertisement
samuelrichter66

stevecraft

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