Advertisement
Mediakiller7Cool

Minecraft

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