Advertisement
ManlyMemeScripter

Untitled

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