Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
- local Player,game,owner = owner,game
- local RealPlayer = Player
- do
- print("FE Compatibility code by Mokiros")
- local rp = RealPlayer
- script.Parent = rp.Character
- --RemoteEvent for communicating
- local Event = Instance.new("RemoteEvent")
- Event.Name = "UserInput_Event"
- --Fake event to make stuff like Mouse.KeyDown work
- local function fakeEvent()
- local t = {_fakeEvent=true,Functions={},Connect=function(self,f)table.insert(self.Functions,f) end}
- t.connect = t.Connect
- return t
- end
- --Creating fake input objects with fake variables
- local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent(),Button2Up=fakeEvent(),Button2Down=fakeEvent()}
- local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
- local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
- CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
- end}
- --Merged 2 functions into one by checking amount of arguments
- CAS.UnbindAction = CAS.BindAction
- --This function will trigger the events that have been :Connect()'ed
- local function te(self,ev,...)
- local t = m[ev]
- if t and t._fakeEvent then
- for _,f in pairs(t.Functions) do
- f(...)
- end
- end
- end
- m.TrigEvent = te
- UIS.TrigEvent = te
- Event.OnServerEvent:Connect(function(plr,io)
- if plr~=rp then return end
- m.Target = io.Target
- m.Hit = io.Hit
- if not io.isMouse then
- local b = io.UserInputState == Enum.UserInputState.Begin
- if io.UserInputType == Enum.UserInputType.MouseButton1 then
- return m:TrigEvent(b and "Button1Down" or "Button1Up")
- end
- if io.UserInputType == Enum.UserInputType.MouseButton2 then
- return m:TrigEvent(b and "Button2Down" or "Button2Up")
- end
- for _,t in pairs(CAS.Actions) do
- for _,k in pairs(t.Keys) do
- if k==io.KeyCode then
- t.Function(t.Name,io.UserInputState,io)
- end
- end
- end
- m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
- UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false)
- end
- end)
- Event.Parent = NLS([==[
- local Player = game:GetService("Players").LocalPlayer
- local Event = script:WaitForChild("UserInput_Event")
- local Mouse = Player:GetMouse()
- local UIS = game:GetService("UserInputService")
- local input = function(io,a)
- if a then return end
- --Since InputObject is a client-side instance, we create and pass table instead
- Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState,Hit=Mouse.Hit,Target=Mouse.Target})
- end
- UIS.InputBegan:Connect(input)
- UIS.InputEnded:Connect(input)
- local h,t
- --Give the server mouse data 30 times every second, but only if the values changed
- --If player is not moving their mouse, client won't fire events
- while wait(1/30) do
- if h~=Mouse.Hit or t~=Mouse.Target then
- h,t=Mouse.Hit,Mouse.Target
- Event:FireServer({isMouse=true,Target=t,Hit=h})
- end
- end]==],Player.Character)
- ----Sandboxed game object that allows the usage of client-side methods and services
- --Real game object
- local _rg = game
- --Metatable for fake service
- local fsmt = {
- __index = function(self,k)
- local s = rawget(self,"_RealService")
- if s then
- return typeof(s[k])=="function"
- and function(_,...)return s[k](s,...)end or s[k]
- end
- end,
- __newindex = function(self,k,v)
- local s = rawget(self,"_RealService")
- if s then s[k]=v end
- end
- }
- local function FakeService(t,RealService)
- t._RealService = typeof(RealService)=="string" and _rg:GetService(RealService) or RealService
- return setmetatable(t,fsmt)
- end
- --Fake game object
- local g = {
- GetService = function(self,s)
- return rawget(self,s) or _rg:GetService(s)
- end,
- Players = FakeService({
- LocalPlayer = FakeService({GetMouse=function(self)return m end},Player)
- },"Players"),
- UserInputService = FakeService(UIS,"UserInputService"),
- ContextActionService = FakeService(CAS,"ContextActionService"),
- RunService = FakeService({
- _btrs = {},
- RenderStepped = _rg:GetService("RunService").Heartbeat,
- BindToRenderStep = function(self,name,_,fun)
- self._btrs[name] = self.Heartbeat:Connect(fun)
- end,
- UnbindFromRenderStep = function(self,name)
- self._btrs[name]:Disconnect()
- end,
- },"RunService")
- }
- rawset(g.Players,"localPlayer",g.Players.LocalPlayer)
- g.service = g.GetService
- FakeService(g,game)
- --Changing owner to fake player object to support owner:GetMouse()
- game,owner = g,g.Players.LocalPlayer
- end
- mas = game.Players.LocalPlayer.Character
- Model0 = mas
- Part1 = mas["Left Leg"]
- SpecialMesh2 = Instance.new("SpecialMesh")
- Part3 = mas.Head
- Part4 = Instance.new("Part")
- SpecialMesh5 = Instance.new("SpecialMesh")
- Part6 = mas["Left Arm"]
- SpecialMesh7 = Instance.new("SpecialMesh")
- Part8 = mas["Right Leg"]
- SpecialMesh9 = Instance.new("SpecialMesh")
- Part10 = mas["Right Arm"]
- SpecialMesh11 = Instance.new("SpecialMesh")
- Part12 = mas.Torso
- Motor6D13 = Instance.new("Motor6D")
- Motor6D14 = mas.Torso["Right Hip"]
- Motor6D15 = mas.Torso["Left Shoulder"]
- Motor6D16 = mas.Torso["Left Hip"]
- Motor6D17 = mas.Torso["Right Shoulder"]
- Motor6D18 = mas.Torso.Neck
- Motor6D19 = Instance.new("Motor6D")
- Motor6D20 = Instance.new("Motor6D")
- Part21 = Instance.new("Part")
- Humanoid22 = mas.Humanoid
- BoolValue23 = Instance.new("BoolValue")
- Hat24 = Instance.new("Hat")
- Part25 = Instance.new("Part")
- SpecialMesh26 = Instance.new("SpecialMesh")
- Part1.Name = "Left Leg"
- Part1.Parent = Model0
- Part1.CFrame = CFrame.new(17.2121964, 16.1186256, -9.75573063, 0.635850847, 1.08027291e-06, -0.771811903, 1.15979674e-07, 0.99999994, 1.49520736e-06, 0.771811843, -1.04024332e-06, 0.635850906)
- Part1.Orientation = Vector3.new(0, -50.5200005, 0)
- Part1.Position = Vector3.new(17.2121964, 16.1186256, -9.75573063)
- Part1.Rotation = Vector3.new(0, -50.5200005, 0)
- Part1.Size = Vector3.new(0.25, 1.25, 0.5)
- Part1.CanCollide = false
- Part1.Locked = true
- Part1.FormFactor = Enum.FormFactor.Custom
- Part1.formFactor = Enum.FormFactor.Custom
- SpecialMesh2.Parent = Part1
- SpecialMesh2.MeshId = "http://www.roblox.com/asset/?id=266560838"
- SpecialMesh2.Scale = Vector3.new(0.5, 0.5, 0.5)
- SpecialMesh2.TextureId = "http://www.roblox.com/asset/?id=266561345"
- SpecialMesh2.MeshType = Enum.MeshType.FileMesh
- Part3.Name = "Head"
- Part3.Parent = Model0
- Part3.CFrame = CFrame.new(17.4359951, 17.6584492, -9.2796402, 0.619189262, -4.49773086e-13, -0.785241783, 8.30163954e-13, 1, 8.18289121e-14, 0.785241783, -7.02547016e-13, 0.619189262)
- Part3.Orientation = Vector3.new(0, -51.7400017, 0)
- Part3.Position = Vector3.new(17.4359951, 17.6584492, -9.2796402)
- Part3.Rotation = Vector3.new(0, -51.7400017, 0)
- Part3.Transparency = 1
- Part3.Size = Vector3.new(0.200000003, 0.200000003, 0.200000003)
- Part3.Locked = true
- Part3.FormFactor = Enum.FormFactor.Custom
- Part3.formFactor = Enum.FormFactor.Custom
- Part4.Name = "Body"
- Part4.Parent = Model0
- Part4.CFrame = CFrame.new(16.5804119, 17.4637737, -8.63537407, 0.635850847, 1.50406515e-06, -0.771811903, 8.61748717e-08, 0.99999994, 2.01974035e-06, 0.771811843, -1.35076436e-06, 0.635850906)
- Part4.Orientation = Vector3.new(0, -50.5200005, 0)
- Part4.Position = Vector3.new(16.5804119, 17.4637737, -8.63537407)
- Part4.Rotation = Vector3.new(0, -50.5200005, 0)
- Part4.Size = Vector3.new(0.200000003, 0.200000003, 0.200000003)
- Part4.CanCollide = false
- Part4.Locked = true
- Part4.FormFactor = Enum.FormFactor.Custom
- Part4.formFactor = Enum.FormFactor.Custom
- SpecialMesh5.Parent = Part4
- SpecialMesh5.MeshId = "http://www.roblox.com/asset/?id=266561157"
- SpecialMesh5.Scale = Vector3.new(0.5, 0.5, 0.5)
- SpecialMesh5.TextureId = "http://www.roblox.com/asset/?id=266561345"
- SpecialMesh5.MeshType = Enum.MeshType.FileMesh
- Part6.Name = "Left Arm"
- Part6.Parent = Model0
- Part6.CFrame = CFrame.new(17.2508888, 17.5350361, -9.66650486, 0.627557099, 1.75614434e-06, -0.778570533, 1.10329182e-07, 0.99999994, 2.34453046e-06, 0.778570473, -1.5572258e-06, 0.627557158)
- Part6.Orientation = Vector3.new(0, -51.1300011, 0)
- Part6.Position = Vector3.new(17.2508888, 17.5350361, -9.66650486)
- Part6.Rotation = Vector3.new(0, -51.1300011, 0)
- Part6.Size = Vector3.new(0.25, 1.25, 0.5)
- Part6.CanCollide = false
- Part6.Locked = true
- Part6.FormFactor = Enum.FormFactor.Custom
- Part6.formFactor = Enum.FormFactor.Custom
- SpecialMesh7.Parent = Part6
- SpecialMesh7.MeshId = "http://www.roblox.com/asset/?id=266560959"
- SpecialMesh7.Scale = Vector3.new(0.5, 0.5, 0.5)
- SpecialMesh7.TextureId = "http://www.roblox.com/asset/?id=266561345"
- SpecialMesh7.MeshType = Enum.MeshType.FileMesh
- Part8.Name = "Right Leg"
- Part8.Parent = Model0
- Part8.CFrame = CFrame.new(17.7828827, 16.1219273, -9.04141808, 0.627539039, -0.00457659597, -0.778571546, 0.0072960481, 0.999973357, 2.66000688e-06, 0.778550744, -0.00568217319, 0.627555907)
- Part8.Orientation = Vector3.new(0, -51.1300011, 0.419999987)
- Part8.Position = Vector3.new(17.7828827, 16.1219273, -9.04141808)
- Part8.Rotation = Vector3.new(0, -51.1300011, 0.419999987)
- Part8.Size = Vector3.new(0.25, 1.25, 0.5)
- Part8.CanCollide = false
- Part8.Locked = true
- Part8.FormFactor = Enum.FormFactor.Custom
- Part8.formFactor = Enum.FormFactor.Custom
- SpecialMesh9.Parent = Part8
- SpecialMesh9.MeshId = "http://www.roblox.com/asset/?id=266560749"
- SpecialMesh9.Scale = Vector3.new(0.5, 0.5, 0.5)
- SpecialMesh9.TextureId = "http://www.roblox.com/asset/?id=266561345"
- SpecialMesh9.MeshType = Enum.MeshType.FileMesh
- Part10.Name = "Right Arm"
- Part10.Parent = Model0
- Part10.CFrame = CFrame.new(17.7250576, 17.5346718, -9.08602715, 0.635850966, 1.63900916e-06, -0.771811783, 8.61745093e-08, 0.99999994, 2.19458093e-06, 0.771811724, -1.4619369e-06, 0.635851026)
- Part10.Orientation = Vector3.new(0, -50.5200005, 0)
- Part10.Position = Vector3.new(17.7250576, 17.5346718, -9.08602715)
- Part10.Rotation = Vector3.new(0, -50.5200005, 0)
- Part10.Size = Vector3.new(0.25, 1.25, 0.5)
- Part10.CanCollide = false
- Part10.Locked = true
- Part10.FormFactor = Enum.FormFactor.Custom
- Part10.formFactor = Enum.FormFactor.Custom
- SpecialMesh11.Parent = Part10
- SpecialMesh11.MeshId = "http://www.roblox.com/asset/?id=266560893"
- SpecialMesh11.Scale = Vector3.new(0.5, 0.5, 0.5)
- SpecialMesh11.TextureId = "http://www.roblox.com/asset/?id=266561345"
- SpecialMesh11.MeshType = Enum.MeshType.FileMesh
- Part12.Name = "Torso"
- Part12.Parent = Model0
- Part12.CFrame = CFrame.new(17.4359951, 17.6584492, -9.2796402, 0.619188428, -9.39329663e-21, -0.785242438, -1.92308264e-21, 1, -1.34786997e-20, 0.785242438, 9.85594101e-21, 0.619188428)
- Part12.Orientation = Vector3.new(0, -51.7400017, 0)
- Part12.Position = Vector3.new(17.4359951, 17.6584492, -9.2796402)
- Part12.Rotation = Vector3.new(0, -51.7400017, 0)
- Part12.Transparency = 1
- Part12.Size = Vector3.new(0.200000003, 1.75625002, 2.375)
- Part12.Locked = true
- Part12.FormFactor = Enum.FormFactor.Custom
- Part12.formFactor = Enum.FormFactor.Custom
- Motor6D13.Name = "Body"
- Motor6D13.Parent = Part12
- Motor6D13.MaxVelocity = 0.050000000745058
- Motor6D13.C0 = CFrame.new(0, 0, 0, 0.0213997271, 3.06415657e-08, 0.999770999, 1.5828283e-06, -1, -3.23126903e-09, 0.999770999, 1.58253499e-06, -0.0213997271)
- Motor6D13.C1 = CFrame.new(0.0467713252, 0.194677427, -1.07000661, -3.87429452e-07, -8.9406754e-08, 0.99999994, -4.36912018e-07, -0.99999994, -8.94069245e-08, 1, -4.36912046e-07, 3.87429424e-07)
- Motor6D13.Part0 = Part12
- Motor6D13.Part1 = Part4
- Motor6D13.part1 = Part4
- Motor6D14.Name = "Right Hip"
- Motor6D14.Parent = Part12
- Motor6D14.MaxVelocity = 0.050000000745058
- Motor6D14.C0 = CFrame.new(-0.832447231, -0.91957283, -1.13750124, -4.37113883e-08, 0, 1, 1, -5.20548554e-07, 4.37113883e-08, 5.20548554e-07, 1, 2.27539003e-14)
- Motor6D14.C1 = CFrame.new(-1.27993977, 0.431621701, 0.0624997243, 0.00729590282, 0.0107000563, 0.999916136, 0.999973416, -7.92443752e-05, -0.00729547208, 1.16229057e-06, 0.99994278, -0.0107003497)
- Motor6D14.Part0 = Part4
- Motor6D14.Part1 = Part8
- Motor6D14.part1 = Part8
- Motor6D15.Name = "Left Shoulder"
- Motor6D15.Parent = Part12
- Motor6D15.MaxVelocity = 0.050000000745058
- Motor6D15.C0 = CFrame.new(-0.0772239119, 0.536951065, -1.17000008, -3.93402502e-07, 0, 1, 1.50995803e-07, -1, 5.94021224e-14, 1, 1.50995803e-07, 3.93402502e-07)
- Motor6D15.C1 = CFrame.new(0.292308807, 0.465685844, 0, 0.0106982943, -9.35213351e-10, 0.99994278, -1.74840551e-07, -1, 9.3533592e-10, 0.99994278, -1.74840551e-07, -0.0106982943)
- Motor6D15.Part0 = Part4
- Motor6D15.Part1 = Part6
- Motor6D15.part1 = Part6
- Motor6D15.DesiredAngle = -0.1130875647068
- Motor6D16.Name = "Left Hip"
- Motor6D16.Parent = Part12
- Motor6D16.MaxVelocity = 0.050000000745058
- Motor6D16.C0 = CFrame.new(-1.31953633, -0.899812698, -1.20000076, 2.48389142e-14, 4.37113883e-08, 1, 1, -5.68248083e-07, 0, 5.68248083e-07, 1, -4.37113883e-08)
- Motor6D16.C1 = CFrame.new(-0.856552124, 0.445333481, 0, 2.98048271e-08, 4.37076224e-08, 1, 1, -4.37150582e-08, -2.98048235e-08, 4.37150582e-08, 1, -4.37076224e-08)
- Motor6D16.Part0 = Part4
- Motor6D16.Part1 = Part1
- Motor6D16.part1 = Part1
- Motor6D17.Name = "Right Shoulder"
- Motor6D17.Parent = Part12
- Motor6D17.MaxVelocity = 0.050000000745058
- Motor6D17.C0 = CFrame.new(0.327462971, 0.531036377, -1.17000008, 2.18556949e-07, 3.82137093e-15, 1, 8.74227766e-08, -1, -1.52854837e-14, 1, 8.74227766e-08, -2.18556949e-07)
- Motor6D17.C1 = CFrame.new(-0.0525417328, 0.460136414, 0, 4.37088445e-08, -3.82092963e-15, 1, -8.74177744e-08, -1, 2.1448709e-22, 1, -8.74177744e-08, -4.37088445e-08)
- Motor6D17.Part0 = Part4
- Motor6D17.Part1 = Part10
- Motor6D17.part1 = Part10
- Motor6D17.DesiredAngle = 0.1130875647068
- Motor6D18.Name = "Neck"
- Motor6D18.Parent = Part12
- Motor6D18.MaxVelocity = 0.050000000745058
- Motor6D18.C0 = CFrame.new(0, 0, 0, 1, -5.53446503e-13, 6.85963641e-07, 5.53446449e-13, 1, 5.44569544e-14, -6.85963641e-07, -5.44565749e-14, 1)
- Motor6D18.C1 = CFrame.new(0, 0, -0, 1, 2.76717532e-13, -3.58160548e-07, -2.76717505e-13, 1, -2.73716766e-14, 3.58160548e-07, 2.73717765e-14, 1)
- Motor6D18.Part0 = Part12
- Motor6D18.Part1 = Part3
- Motor6D18.part1 = Part3
- Motor6D19.Name = "NeckPart"
- Motor6D19.Parent = Part12
- Motor6D19.MaxVelocity = 0.050000000745058
- Motor6D19.C0 = CFrame.new(-0.0350734144, 0.907989502, -1.21914947, 4.80827566e-07, 2.08616186e-07, -1, -1, -4.37417498e-08, -4.80827566e-07, -4.37418493e-08, 1, 2.08616186e-07)
- Motor6D19.C1 = CFrame.new(-0.0351963751, 0.854220927, -1.17417181, -4.37036007e-08, 3.87430021e-07, -1, -1, -4.37442438e-08, 4.37035865e-08, -4.3744226e-08, 1, 3.87430049e-07)
- Motor6D19.Part0 = Part4
- Motor6D19.Part1 = Part21
- Motor6D19.part1 = Part21
- Motor6D20.Name = "FakeNeck"
- Motor6D20.Parent = Part12
- Motor6D20.MaxVelocity = 0.014999999664724
- Motor6D20.C0 = CFrame.new(0.0123147964, 1.33133173, -1.11855698, 0.99999994, 2.98238945e-07, -5.95013141e-08, -5.96421685e-08, 0.000472270971, -0.999999881, -2.98210836e-07, 0.99999994, 0.000472271)
- Motor6D20.C1 = CFrame.new(0.0121087888, 0.15480186, 0.126358256, 0.99999994, 2.98482973e-07, -8.9237659e-08, -8.95195811e-08, 0.000944573316, -0.999999464, -2.98398618e-07, 0.999999464, 0.000944573141)
- Motor6D20.Part0 = Part21
- Motor6D20.Part1 = Part25
- Motor6D20.part1 = Part25
- Part21.Name = "Neck"
- Part21.Parent = Model0
- Part21.CFrame = CFrame.new(16.6152039, 17.5175419, -8.66387844, 0.635850728, 1.17054333e-06, -0.771812022, 6.10706309e-07, 0.99999994, 2.01974262e-06, 0.771811962, -1.75560524e-06, 0.635850787)
- Part21.Orientation = Vector3.new(0, -50.5200005, 0)
- Part21.Position = Vector3.new(16.6152039, 17.5175419, -8.66387844)
- Part21.Rotation = Vector3.new(0, -50.5200005, 0)
- Part21.Transparency = 1
- Part21.Size = Vector3.new(0.200000003, 0.200000003, 0.200000003)
- Part21.CanCollide = false
- Part21.Locked = true
- Part21.FormFactor = Enum.FormFactor.Custom
- Part21.formFactor = Enum.FormFactor.Custom
- Humanoid22.Parent = Model0
- Humanoid22.LeftLeg = Part1
- Humanoid22.NameOcclusion = Enum.NameOcclusion.NoOcclusion
- Humanoid22.RightLeg = Part8
- Humanoid22.Torso = Part12
- Humanoid22.WalkSpeed = 18
- BoolValue23.Name = "Standing"
- BoolValue23.Parent = Model0
- BoolValue23.Value = true
- Hat24.Parent = Model0
- Part25.Name = "FakeHead"
- Part25.Parent = Model0
- Part25.CFrame = CFrame.new(17.5762329, 18.694128, -9.45534801, 0.635850668, -0.000363377127, -0.771811903, 6.40442693e-07, 0.999999702, -0.000470282539, 0.771811843, 0.000298535364, 0.635850668)
- Part25.Orientation = Vector3.new(0.0299999993, -50.5200005, 0)
- Part25.Position = Vector3.new(17.5762329, 18.694128, -9.45534801)
- Part25.Rotation = Vector3.new(0.0399999991, -50.5200005, 0.0299999993)
- Part25.Size = Vector3.new(0.75, 0.75, 0.75)
- Part25.CanCollide = false
- Part25.Locked = true
- Part25.FormFactor = Enum.FormFactor.Custom
- Part25.formFactor = Enum.FormFactor.Custom
- SpecialMesh26.Parent = Part25
- SpecialMesh26.MeshId = "http://www.roblox.com/asset/?id=266561002"
- SpecialMesh26.Scale = Vector3.new(0.5, 0.5, 0.5)
- SpecialMesh26.TextureId = "http://www.roblox.com/asset/?id=266561345"
- SpecialMesh26.MeshType = Enum.MeshType.FileMesh
- --Made by Luckymaxer
- Figure = mas
- RunService = game:GetService("RunService")
- Creator = Figure:FindFirstChild("Creator")
- Standing = Figure:WaitForChild("Standing")
- Target = Figure:FindFirstChild("Target")
- Humanoid = Figure:WaitForChild("Humanoid")
- Head = Figure:WaitForChild("Head")
- FakeHead = Figure:FindFirstChild("FakeHead")
- Neck = Figure:FindFirstChild("Neck")
- Torso = Figure:WaitForChild("Torso")
- NeckPart = Torso:FindFirstChild("NeckPart")
- Body = Torso:FindFirstChild("Body")
- Neck = Torso:FindFirstChild("FakeNeck")
- LeftShoulder = Torso:WaitForChild("Left Shoulder")
- RightShoulder = Torso:WaitForChild("Right Shoulder")
- LeftHip = Torso:WaitForChild("Left Hip")
- RightHip = Torso:WaitForChild("Right Hip")
- for i, v in pairs({Neck, LeftShoulder, RightShoulder, LeftHip, RightHip}) do
- if v and v.Parent then
- v.DesiredAngle = 0
- v.CurrentAngle = 0
- end
- end
- Pose = "None"
- LastPose = Pose
- PoseTime = 0
- StandTime = 0
- function SetPose(pose)
- LastPose = Pose
- Pose = pose
- PoseTime = tick()
- end
- function MonitorDead()
- for i, v in pairs({FakeHead, Neck, NeckPart, Body, Neck}) do
- if not v or not v.Parent then
- Humanoid:ChangeState(Enum.HumanoidStateType.Dead)
- return true
- end
- end
- return false
- end
- function MonitorRunningPose()
- local Speed = (Torso.Velocity * Vector3.new(1, 0, 1)).Magnitude
- local Now = tick()
- local MinSpeed = 5
- if Speed >= MinSpeed or (Target and Target.Value) then
- Standing.Value = false
- elseif Speed < MinSpeed and (Now - StandTime) > 1.5 then
- Standing.Value = true
- end
- end
- function OnRunning(Speed)
- if Speed > 0 then
- SetPose("Running")
- else
- SetPose("Standing")
- end
- end
- function OnDied()
- SetPose("Dead")
- end
- function OnJumping()
- SetPose("Jumping")
- end
- function OnClimbing()
- SetPose("Climbing")
- end
- function OnGettingUp()
- SetPose("GettingUp")
- end
- function OnFreeFall()
- SetPose("FreeFall")
- end
- function OnFallingDown()
- SetPose("FallingDown")
- end
- function OnSeated()
- SetPose("Seated")
- end
- function OnPlatformStanding()
- SetPose("PlatformStanding")
- end
- function OnSwimming(Speed)
- return OnRunning(Speed)
- end
- function MoveJump()
- if not Standing.Value then
- LeftShoulder.DesiredAngle = (math.pi / 2)
- RightShoulder.DesiredAngle = (math.pi / 2)
- LeftHip.DesiredAngle = (math.pi / 2)
- RightHip.DesiredAngle = (math.pi / 2)
- else
- LeftShoulder.DesiredAngle = (math.pi / 1.25)
- RightShoulder.DesiredAngle = (math.pi / 1.25)
- LeftHip.DesiredAngle = 0
- RightHip.DesiredAngle = 0
- end
- end
- function MoveFreeFall()
- RightShoulder.DesiredAngle = 0.5
- LeftShoulder.DesiredAngle = -0.5
- RightHip.DesiredAngle = -0.5
- LeftHip.DesiredAngle = 0.5
- end
- function MoveSit()
- RightShoulder.DesiredAngle = (math.pi / 2)
- LeftShoulder.DesiredAngle = (math.pi / 2)
- RightHip.DesiredAngle = (math.pi / 2)
- LeftHip.DesiredAngle = (math.pi / 2)
- end
- function Move(Time)
- local LimbAmplitude
- local LimbFrequency
- local NeckAmplitude
- local NeckFrequency
- local NeckDesiredAngle
- if (Pose == "Jumping") then
- MoveJump()
- return
- elseif (Pose == "FreeFall") then
- MoveFreeFall()
- return
- elseif (Pose == "Seated") then
- MoveSit()
- return
- end
- local ClimbFudge = 0
- if (Pose == "Running") then
- LimbAmplitude = 1
- LimbFrequency = 9
- NeckAmplitude = 0
- NeckFrequency = 0
- NeckDesiredAngle = 0
- if Creator and Creator.Value and Creator.Value:IsA("Player") and Creator.Value.Character then
- local CreatorCharacter = Creator.Value.Character
- local CreatorHead = CreatorCharacter:FindFirstChild("Head")
- if CreatorHead then
- local TargetPosition = CreatorHead.Position
- local Direction = Torso.CFrame.lookVector
- local HeadPosition = Head.Position
- NeckDesiredAngle = ((((HeadPosition - TargetPosition).Unit):Cross(Direction)).Y / 4)
- end
- end
- elseif (Pose == "Climbing") then
- LimbAmplitude = 1
- LimbFrequency = 9
- NeckAmplitude = 0
- NeckFrequency = 0
- NeckDesiredAngle = 0
- ClimbFudge = math.pi
- else
- LimbAmplitude = 0.125
- LimbFrequency = 2.25
- NeckAmplitude = ((not Standing.Value and 0.5) or 0)
- NeckFrequency = ((not Standing.Value and 1.25) or 0)
- end
- NeckDesiredAngle = ((not NeckDesiredAngle and (NeckAmplitude * math.sin(Time * NeckFrequency))) or NeckDesiredAngle)
- LimbDesiredAngle1 = ((LimbAmplitude * math.sin(Time * LimbFrequency)) + ((not Standing.Value and (math.pi / 2)) or 0))
- LimbDesiredAngle2 = ((LimbAmplitude * -math.sin(Time * LimbFrequency)) + ((not Standing.Value and (math.pi / 2)) or 0))
- Neck.DesiredAngle = NeckDesiredAngle
- RightShoulder.DesiredAngle = (LimbDesiredAngle1 + ClimbFudge)
- LeftShoulder.DesiredAngle = (LimbDesiredAngle2 + ClimbFudge)
- RightHip.DesiredAngle = ((not Standing.Value and LimbDesiredAngle2) or 0)
- LeftHip.DesiredAngle = ((not Standing.Value and LimbDesiredAngle1) or 0)
- end
- function SetStandPose()
- if Standing.Value then
- Body.DesiredAngle = 0
- NeckPart.DesiredAngle = 0
- Body.C0 = (CFrame.new(0, 0, 0) * CFrame.Angles(Body.C0:toEulerAnglesXYZ()))
- else
- NeckPart.DesiredAngle = -1
- Body.DesiredAngle = -(math.pi / 2)
- Body.C0 = (CFrame.new(0, -0.9, 0) * CFrame.Angles(Body.C0:toEulerAnglesXYZ()))
- end
- end
- if MonitorDead() then
- return
- end
- SetStandPose()
- Standing.Changed:connect(SetStandPose)
- Humanoid.Died:connect(OnDied)
- Humanoid.Running:connect(OnRunning)
- Humanoid.Jumping:connect(OnJumping)
- Humanoid.Climbing:connect(OnClimbing)
- Humanoid.GettingUp:connect(OnGettingUp)
- Humanoid.FreeFalling:connect(OnFreeFall)
- Humanoid.FallingDown:connect(OnFallingDown)
- Humanoid.Seated:connect(OnSeated)
- Humanoid.PlatformStanding:connect(OnPlatformStanding)
- Humanoid.Swimming:connect(OnSwimming)
- Humanoid:ChangeState(Enum.HumanoidStateType.None)
- RunService.Stepped:connect(function()
- local _, Time = wait(0.1)
- MonitorRunningPose()
- MonitorDead()
- Move(Time)
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement