Advertisement
ManlyMemeScripter

Untitled

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