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,Mouse,mouse,UserInputService,ContextActionService = owner
- do
- print("FE Compatibility code by Mokiros")
- script.Parent = Player.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,Connect=function(self,f)self.Function=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()}
- 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 and t.Function then
- t.Function(...)
- end
- end
- m.TrigEvent = te
- UIS.TrigEvent = te
- Event.OnServerEvent:Connect(function(plr,io)
- if plr~=Player then return end
- if io.isMouse then
- m.Target = io.Target
- m.Hit = io.Hit
- else
- local b = io.UserInputState == Enum.UserInputState.Begin
- if io.UserInputType == Enum.UserInputType.MouseButton1 then
- return m:TrigEvent(b and "Button1Down" or "Button1Up")
- 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 = owner
- local Event = script:WaitForChild("UserInput_Event")
- 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})
- end
- UIS.InputBegan:Connect(input)
- UIS.InputEnded:Connect(input)
- local Mouse = Player:GetMouse()
- 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)
- Mouse,mouse,UserInputService,ContextActionService = m,m,UIS,CAS
- end
- --Converted with ttyyuu12345's model to script plugin v4
- function sandbox(var,func)
- local env = getfenv(func)
- local newenv = setmetatable({},{
- __index = function(self,k)
- if k=="script" then
- return var
- else
- return env[k]
- end
- end,
- })
- setfenv(func,newenv)
- return func
- end
- cors = {}
- mas = Instance.new("Model",game:GetService("Lighting"))
- Model0 = Instance.new("Model")
- Part1 = Instance.new("Part")
- Decal2 = Instance.new("Decal")
- Sound3 = Instance.new("Sound")
- Sound4 = Instance.new("Sound")
- Sound5 = Instance.new("Sound")
- Sound6 = Instance.new("Sound")
- Sound7 = Instance.new("Sound")
- Sound8 = Instance.new("Sound")
- Sound9 = Instance.new("Sound")
- Sound10 = Instance.new("Sound")
- Sound11 = Instance.new("Sound")
- CylinderMesh12 = Instance.new("CylinderMesh")
- Part13 = Instance.new("Part")
- Decal14 = Instance.new("Decal")
- Motor6D15 = Instance.new("Motor6D")
- Motor6D16 = Instance.new("Motor6D")
- Motor6D17 = Instance.new("Motor6D")
- Motor6D18 = Instance.new("Motor6D")
- Motor6D19 = Instance.new("Motor6D")
- Part20 = Instance.new("Part")
- Part21 = Instance.new("Part")
- Part22 = Instance.new("Part")
- Part23 = Instance.new("Part")
- Humanoid24 = Instance.new("Humanoid")
- Part25 = Instance.new("Part")
- Motor6D26 = Instance.new("Motor6D")
- Script27 = Instance.new("Script")
- LocalScript28 = Instance.new("LocalScript")
- LocalScript29 = Instance.new("LocalScript")
- StringValue30 = Instance.new("StringValue")
- Animation31 = Instance.new("Animation")
- NumberValue32 = Instance.new("NumberValue")
- Animation33 = Instance.new("Animation")
- NumberValue34 = Instance.new("NumberValue")
- StringValue35 = Instance.new("StringValue")
- Animation36 = Instance.new("Animation")
- StringValue37 = Instance.new("StringValue")
- Animation38 = Instance.new("Animation")
- StringValue39 = Instance.new("StringValue")
- Animation40 = Instance.new("Animation")
- StringValue41 = Instance.new("StringValue")
- Animation42 = Instance.new("Animation")
- StringValue43 = Instance.new("StringValue")
- Animation44 = Instance.new("Animation")
- StringValue45 = Instance.new("StringValue")
- Animation46 = Instance.new("Animation")
- StringValue47 = Instance.new("StringValue")
- Animation48 = Instance.new("Animation")
- Script49 = Instance.new("Script")
- BodyColors50 = Instance.new("BodyColors")
- Model0.Name = "oii"
- Model0.Parent = mas
- Part1.Name = "Head"
- Part1.Parent = Model0
- Part1.CFrame = CFrame.new(13.7936363, 4.50001431, -22.1235237, 0.993757904, 0, -0.111558832, 0, 1, 0, 0.111558832, 0, 0.993757904)
- Part1.Orientation = Vector3.new(0, -6.40999985, 0)
- Part1.Position = Vector3.new(13.7936363, 4.50001431, -22.1235237)
- Part1.Rotation = Vector3.new(0, -6.40999985, 0)
- Part1.Color = Color3.new(0.803922, 0, 0)
- Part1.Velocity = Vector3.new(5.33474325e-42, 0, -4.77520478e-41)
- Part1.Size = Vector3.new(2, 1, 1)
- Part1.BrickColor = BrickColor.new("Really red")
- Part1.Locked = true
- Part1.TopSurface = Enum.SurfaceType.Smooth
- Part1.brickColor = BrickColor.new("Really red")
- Part1.FormFactor = Enum.FormFactor.Symmetric
- Part1.formFactor = Enum.FormFactor.Symmetric
- Decal2.Name = "face"
- Decal2.Parent = Part1
- Decal2.Texture = "rbxasset://textures/face.png"
- Sound3.Name = "GettingUp"
- Sound3.Parent = Part1
- Sound3.MaxDistance = 150
- Sound3.EmitterSize = 5
- Sound3.MinDistance = 5
- Sound3.SoundId = "rbxasset://sounds/action_get_up.mp3"
- Sound3.Volume = 0.64999997615814
- Sound4.Name = "Died"
- Sound4.Parent = Part1
- Sound4.MaxDistance = 150
- Sound4.EmitterSize = 5
- Sound4.MinDistance = 5
- Sound4.SoundId = "rbxasset://sounds/uuhhh.mp3"
- Sound4.Volume = 0.64999997615814
- Sound5.Name = "FreeFalling"
- Sound5.Parent = Part1
- Sound5.Looped = true
- Sound5.TimePosition = 0.52838909903676
- Sound5.MaxDistance = 150
- Sound5.EmitterSize = 5
- Sound5.MinDistance = 5
- Sound5.SoundId = "rbxasset://sounds/action_falling.mp3"
- Sound5.Volume = 0
- Sound6.Name = "Jumping"
- Sound6.Parent = Part1
- Sound6.MaxDistance = 150
- Sound6.EmitterSize = 5
- Sound6.MinDistance = 5
- Sound6.SoundId = "rbxasset://sounds/action_jump.mp3"
- Sound6.Volume = 0.64999997615814
- Sound7.Name = "Landing"
- Sound7.Parent = Part1
- Sound7.MaxDistance = 150
- Sound7.EmitterSize = 5
- Sound7.MinDistance = 5
- Sound7.SoundId = "rbxasset://sounds/action_jump_land.mp3"
- Sound7.Volume = 1
- Sound8.Name = "Splash"
- Sound8.Parent = Part1
- Sound8.MaxDistance = 150
- Sound8.EmitterSize = 5
- Sound8.MinDistance = 5
- Sound8.SoundId = "rbxasset://sounds/impact_water.mp3"
- Sound8.Volume = 0.64999997615814
- Sound9.Name = "Running"
- Sound9.Parent = Part1
- Sound9.Looped = true
- Sound9.TimePosition = 1.7229757305085
- Sound9.MaxDistance = 150
- Sound9.EmitterSize = 5
- Sound9.MinDistance = 5
- Sound9.Pitch = 1.8500000238419
- Sound9.PlaybackSpeed = 1.8500000238419
- Sound9.SoundId = "rbxasset://sounds/action_footsteps_plastic.mp3"
- Sound9.Volume = 0.64999997615814
- Sound10.Name = "Swimming"
- Sound10.Parent = Part1
- Sound10.Looped = true
- Sound10.MaxDistance = 150
- Sound10.EmitterSize = 5
- Sound10.MinDistance = 5
- Sound10.Pitch = 1.6000000238419
- Sound10.PlaybackSpeed = 1.6000000238419
- Sound10.SoundId = "rbxasset://sounds/action_swim.mp3"
- Sound10.Volume = 0.64999997615814
- Sound11.Name = "Climbing"
- Sound11.Parent = Part1
- Sound11.Looped = true
- Sound11.MaxDistance = 150
- Sound11.EmitterSize = 5
- Sound11.MinDistance = 5
- Sound11.SoundId = "rbxasset://sounds/action_footsteps_plastic.mp3"
- Sound11.Volume = 0.64999997615814
- CylinderMesh12.Parent = Part1
- CylinderMesh12.Scale = Vector3.new(1.29999995, 1.29999995, 1.29999995)
- Part13.Name = "Torso"
- Part13.Parent = Model0
- Part13.CFrame = CFrame.new(13.7936363, 3.00001407, -22.1235237, 0.993757904, 0, -0.111558832, 0, 1, 0, 0.111558832, 0, 0.993757904)
- Part13.Orientation = Vector3.new(0, -6.40999985, 0)
- Part13.Position = Vector3.new(13.7936363, 3.00001407, -22.1235237)
- Part13.Rotation = Vector3.new(0, -6.40999985, 0)
- Part13.Color = Color3.new(1, 1, 0)
- Part13.Velocity = Vector3.new(5.33474325e-42, 0, -4.77520478e-41)
- Part13.Size = Vector3.new(2, 2, 1)
- Part13.BrickColor = BrickColor.new("New Yeller")
- Part13.LeftParamA = 0
- Part13.LeftParamB = 0
- Part13.LeftSurface = Enum.SurfaceType.Weld
- Part13.Locked = true
- Part13.RightParamA = 0
- Part13.RightParamB = 0
- Part13.RightSurface = Enum.SurfaceType.Weld
- Part13.brickColor = BrickColor.new("New Yeller")
- Part13.FormFactor = Enum.FormFactor.Symmetric
- Part13.formFactor = Enum.FormFactor.Symmetric
- Decal14.Name = "roblox"
- Decal14.Parent = Part13
- Motor6D15.Name = "Right Shoulder"
- Motor6D15.Parent = Part13
- Motor6D15.MaxVelocity = 0.10000000149012
- Motor6D15.C0 = CFrame.new(1, 0.5, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0)
- Motor6D15.C1 = CFrame.new(-0.5, 0.5, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0)
- Motor6D15.Part0 = Part13
- Motor6D15.Part1 = Part21
- Motor6D15.part1 = Part21
- Motor6D16.Name = "Left Shoulder"
- Motor6D16.Parent = Part13
- Motor6D16.MaxVelocity = 0.10000000149012
- Motor6D16.C0 = CFrame.new(-1, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
- Motor6D16.C1 = CFrame.new(0.5, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
- Motor6D16.Part0 = Part13
- Motor6D16.Part1 = Part20
- Motor6D16.part1 = Part20
- Motor6D17.Name = "Right Hip"
- Motor6D17.Parent = Part13
- Motor6D17.MaxVelocity = 0.10000000149012
- Motor6D17.C0 = CFrame.new(1, -1, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0)
- Motor6D17.C1 = CFrame.new(0.5, 1, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0)
- Motor6D17.Part0 = Part13
- Motor6D17.Part1 = Part23
- Motor6D17.part1 = Part23
- Motor6D18.Name = "Left Hip"
- Motor6D18.Parent = Part13
- Motor6D18.MaxVelocity = 0.10000000149012
- Motor6D18.C0 = CFrame.new(-1, -1, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
- Motor6D18.C1 = CFrame.new(-0.5, 1, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
- Motor6D18.Part0 = Part13
- Motor6D18.Part1 = Part22
- Motor6D18.part1 = Part22
- Motor6D19.Name = "Neck"
- Motor6D19.Parent = Part13
- Motor6D19.MaxVelocity = 0.10000000149012
- Motor6D19.C0 = CFrame.new(0, 1, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)
- Motor6D19.C1 = CFrame.new(0, -0.5, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)
- Motor6D19.Part0 = Part13
- Motor6D19.Part1 = Part1
- Motor6D19.part1 = Part1
- Part20.Name = "Left Arm"
- Part20.Parent = Model0
- Part20.CFrame = CFrame.new(12.3029995, 3.00001407, -22.2908611, 0.993757904, 0, -0.111558832, 0, 1, 0, 0.111558832, 0, 0.993757904)
- Part20.Orientation = Vector3.new(0, -6.40999985, 0)
- Part20.Position = Vector3.new(12.3029995, 3.00001407, -22.2908611)
- Part20.Rotation = Vector3.new(0, -6.40999985, 0)
- Part20.Color = Color3.new(0.803922, 0, 0)
- Part20.Velocity = Vector3.new(5.33474325e-42, 0, -4.77520478e-41)
- Part20.Size = Vector3.new(1, 2, 1)
- Part20.BrickColor = BrickColor.new("Really red")
- Part20.CanCollide = false
- Part20.Locked = true
- Part20.brickColor = BrickColor.new("Really red")
- Part20.FormFactor = Enum.FormFactor.Symmetric
- Part20.formFactor = Enum.FormFactor.Symmetric
- Part21.Name = "Right Arm"
- Part21.Parent = Model0
- Part21.CFrame = CFrame.new(15.2842731, 3.00001407, -21.9561863, 0.993757904, 0, -0.111558832, 0, 1, 0, 0.111558832, 0, 0.993757904)
- Part21.Orientation = Vector3.new(0, -6.40999985, 0)
- Part21.Position = Vector3.new(15.2842731, 3.00001407, -21.9561863)
- Part21.Rotation = Vector3.new(0, -6.40999985, 0)
- Part21.Color = Color3.new(0.803922, 0, 0)
- Part21.Velocity = Vector3.new(5.33474325e-42, 0, -4.77520478e-41)
- Part21.Size = Vector3.new(1, 2, 1)
- Part21.BrickColor = BrickColor.new("Really red")
- Part21.CanCollide = false
- Part21.Locked = true
- Part21.brickColor = BrickColor.new("Really red")
- Part21.FormFactor = Enum.FormFactor.Symmetric
- Part21.formFactor = Enum.FormFactor.Symmetric
- Part22.Name = "Left Leg"
- Part22.Parent = Model0
- Part22.CFrame = CFrame.new(13.2967577, 1.00001407, -22.1793022, 0.993757904, 0, -0.111558832, 0, 1, 0, 0.111558832, 0, 0.993757904)
- Part22.Orientation = Vector3.new(0, -6.40999985, 0)
- Part22.Position = Vector3.new(13.2967577, 1.00001407, -22.1793022)
- Part22.Rotation = Vector3.new(0, -6.40999985, 0)
- Part22.Color = Color3.new(1, 1, 0)
- Part22.Velocity = Vector3.new(5.33474325e-42, 0, -4.77520478e-41)
- Part22.Size = Vector3.new(1, 2, 1)
- Part22.BottomSurface = Enum.SurfaceType.Smooth
- Part22.BrickColor = BrickColor.new("New Yeller")
- Part22.CanCollide = false
- Part22.Locked = true
- Part22.brickColor = BrickColor.new("New Yeller")
- Part22.FormFactor = Enum.FormFactor.Symmetric
- Part22.formFactor = Enum.FormFactor.Symmetric
- Part23.Name = "Right Leg"
- Part23.Parent = Model0
- Part23.CFrame = CFrame.new(14.2905149, 1.00001407, -22.0677452, 0.993757904, 0, -0.111558832, 0, 1, 0, 0.111558832, 0, 0.993757904)
- Part23.Orientation = Vector3.new(0, -6.40999985, 0)
- Part23.Position = Vector3.new(14.2905149, 1.00001407, -22.0677452)
- Part23.Rotation = Vector3.new(0, -6.40999985, 0)
- Part23.Color = Color3.new(1, 1, 0)
- Part23.Velocity = Vector3.new(5.33474325e-42, 0, -4.77520478e-41)
- Part23.Size = Vector3.new(1, 2, 1)
- Part23.BottomSurface = Enum.SurfaceType.Smooth
- Part23.BrickColor = BrickColor.new("New Yeller")
- Part23.CanCollide = false
- Part23.Locked = true
- Part23.brickColor = BrickColor.new("New Yeller")
- Part23.FormFactor = Enum.FormFactor.Symmetric
- Part23.formFactor = Enum.FormFactor.Symmetric
- Humanoid24.Parent = Model0
- Humanoid24.LeftLeg = Part22
- Humanoid24.RightLeg = Part23
- Humanoid24.Torso = Part25
- Part25.Name = "HumanoidRootPart"
- Part25.Parent = Model0
- Part25.CFrame = CFrame.new(13.7936363, 3.00001407, -22.1235237, 0.993757904, 0, -0.111558832, 0, 1, 0, 0.111558832, 0, 0.993757904)
- Part25.Orientation = Vector3.new(0, -6.40999985, 0)
- Part25.Position = Vector3.new(13.7936363, 3.00001407, -22.1235237)
- Part25.Rotation = Vector3.new(0, -6.40999985, 0)
- Part25.Transparency = 1
- Part25.Velocity = Vector3.new(5.33474325e-42, 0, -4.77520478e-41)
- Part25.Size = Vector3.new(2, 2, 1)
- Part25.BottomSurface = Enum.SurfaceType.Smooth
- Part25.CanCollide = false
- Part25.LeftParamA = 0
- Part25.LeftParamB = 0
- Part25.Locked = true
- Part25.RightParamA = 0
- Part25.RightParamB = 0
- Part25.TopSurface = Enum.SurfaceType.Smooth
- Part25.FormFactor = Enum.FormFactor.Symmetric
- Part25.formFactor = Enum.FormFactor.Symmetric
- Motor6D26.Name = "RootJoint"
- Motor6D26.Parent = Part25
- Motor6D26.MaxVelocity = 0.10000000149012
- Motor6D26.C0 = CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)
- Motor6D26.C1 = CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)
- Motor6D26.Part0 = Part25
- Motor6D26.Part1 = Part13
- Motor6D26.part1 = Part13
- Script27.Name = "Sound"
- Script27.Parent = Model0
- table.insert(cors,sandbox(Script27,function()
- --[[
- Author: @spotco
- This script creates sounds which are placed under the character head.
- These sounds are used by the "LocalSound" script.
- To modify this script, copy it to your "StarterPlayer/StarterCharacterScripts" folder keeping the same script name ("Sound").
- The default Sound script loaded for every character will then be replaced with your copy of the script.
- ]]--
- function CreateNewSound(name, id, looped, pitch, parent)
- local sound = Instance.new("Sound")
- sound.SoundId = id
- sound.Name = name
- sound.archivable = false
- sound.Parent = parent
- sound.Pitch = pitch
- sound.Looped = looped
- sound.MinDistance = 5
- sound.MaxDistance = 150
- sound.Volume = 0.65
- return sound
- end
- local head = script.Parent:FindFirstChild("Head")
- if head == nil then
- error("Sound script parent has no child Head.")
- return
- end
- CreateNewSound("GettingUp", "rbxasset://sounds/action_get_up.mp3", false, 1, head)
- CreateNewSound("Died", "rbxasset://sounds/uuhhh.mp3", false, 1, head)
- CreateNewSound("FreeFalling", "rbxasset://sounds/action_falling.mp3", true, 1, head)
- CreateNewSound("Jumping", "rbxasset://sounds/action_jump.mp3", false, 1, head)
- CreateNewSound("Landing", "rbxasset://sounds/action_jump_land.mp3", false, 1, head)
- CreateNewSound("Splash", "rbxasset://sounds/impact_water.mp3", false, 1, head)
- CreateNewSound("Running", "rbxasset://sounds/action_footsteps_plastic.mp3", true, 1.85, head)
- CreateNewSound("Swimming", "rbxasset://sounds/action_swim.mp3", true, 1.6, head)
- CreateNewSound("Climbing", "rbxasset://sounds/action_footsteps_plastic.mp3", true, 1, head)
- end))
- LocalScript28.Name = "LocalSound"
- LocalScript28.Parent = Script27
- table.insert(cors,sandbox(LocalScript28,function()
- --[[
- Author: @spotco
- This script runs locally for the player of the given humanoid.
- This script triggers humanoid sound play/pause actions locally.
- The Playing/TimePosition properties of Sound objects bypass FilteringEnabled, so this triggers the sound
- immediately for the player and is replicated to all other players.
- This script is optimized to reduce network traffic through minimizing the amount of property replication.
- ]]--
- --All sounds are referenced by this ID
- local SFX = {
- Died = 0;
- Running = 1;
- Swimming = 2;
- Climbing = 3,
- Jumping = 4;
- GettingUp = 5;
- FreeFalling = 6;
- FallingDown = 7;
- Landing = 8;
- Splash = 9;
- }
- local Humanoid = nil
- local Head = nil
- --SFX ID to Sound object
- local Sounds = {}
- do
- local Figure = script.Parent.Parent
- Head = Figure:WaitForChild("Head")
- while not Humanoid do
- for _,NewHumanoid in pairs(Figure:GetChildren()) do
- if NewHumanoid:IsA("Humanoid") then
- Humanoid = NewHumanoid
- break
- end
- end
- Figure.ChildAdded:wait()
- end
- Sounds[SFX.Died] = Head:WaitForChild("Died")
- Sounds[SFX.Running] = Head:WaitForChild("Running")
- Sounds[SFX.Swimming] = Head:WaitForChild("Swimming")
- Sounds[SFX.Climbing] = Head:WaitForChild("Climbing")
- Sounds[SFX.Jumping] = Head:WaitForChild("Jumping")
- Sounds[SFX.GettingUp] = Head:WaitForChild("GettingUp")
- Sounds[SFX.FreeFalling] = Head:WaitForChild("FreeFalling")
- Sounds[SFX.Landing] = Head:WaitForChild("Landing")
- Sounds[SFX.Splash] = Head:WaitForChild("Splash")
- end
- local Util
- Util = {
- --Define linear relationship between (pt1x,pt2x) and (pt2x,pt2y). Evaluate this at x.
- YForLineGivenXAndTwoPts = function(x,pt1x,pt1y,pt2x,pt2y)
- --(y - y1)/(x - x1) = m
- local m = (pt1y - pt2y) / (pt1x - pt2x)
- --float b = pt1.y - m * pt1.x;
- local b = (pt1y - m * pt1x)
- return m * x + b
- end;
- --Clamps the value of "val" between the "min" and "max"
- Clamp = function(val,min,max)
- return math.min(max,math.max(min,val))
- end;
- --Gets the horizontal (x,z) velocity magnitude of the given part
- HorizontalSpeed = function(Head)
- local hVel = Head.Velocity + Vector3.new(0,-Head.Velocity.Y,0)
- return hVel.magnitude
- end;
- --Gets the vertical (y) velocity magnitude of the given part
- VerticalSpeed = function(Head)
- return math.abs(Head.Velocity.Y)
- end;
- --Setting Playing/TimePosition values directly result in less network traffic than Play/Pause/Resume/Stop
- --If these properties are enabled, use them.
- Play = function(sound)
- if sound.TimePosition ~= 0 then
- sound.TimePosition = 0
- end
- if not sound.IsPlaying then
- sound.Playing = true
- end
- end;
- Pause = function(sound)
- if sound.IsPlaying then
- sound.Playing = false
- end
- end;
- Resume = function(sound)
- if not sound.IsPlaying then
- sound.Playing = true
- end
- end;
- Stop = function(sound)
- if sound.IsPlaying then
- sound.Playing = false
- end
- if sound.TimePosition ~= 0 then
- sound.TimePosition = 0
- end
- end;
- }
- do
- -- List of all active Looped sounds
- local playingLoopedSounds = {}
- -- Last seen Enum.HumanoidStateType
- local activeState = nil
- -- Verify and set that "sound" is in "playingLoopedSounds".
- function setSoundInPlayingLoopedSounds(sound)
- for i=1, #playingLoopedSounds do
- if playingLoopedSounds[i] == sound then
- return
- end
- end
- table.insert(playingLoopedSounds,sound)
- end
- -- Stop all active looped sounds except parameter "except". If "except" is not passed, all looped sounds will be stopped.
- function stopPlayingLoopedSoundsExcept(except)
- for i=#playingLoopedSounds,1,-1 do
- if playingLoopedSounds[i] ~= except then
- Util.Pause(playingLoopedSounds[i])
- table.remove(playingLoopedSounds,i)
- end
- end
- end
- -- Table of Enum.HumanoidStateType to handling function
- local stateUpdateHandler = {
- [Enum.HumanoidStateType.Dead] = function()
- stopPlayingLoopedSoundsExcept()
- local sound = Sounds[SFX.Died]
- Util.Play(sound)
- end;
- [Enum.HumanoidStateType.RunningNoPhysics] = function()
- stateUpdated(Enum.HumanoidStateType.Running)
- end;
- [Enum.HumanoidStateType.Running] = function()
- local sound = Sounds[SFX.Running]
- stopPlayingLoopedSoundsExcept(sound)
- if Util.HorizontalSpeed(Head) > 0.5 then
- Util.Resume(sound)
- setSoundInPlayingLoopedSounds(sound)
- else
- stopPlayingLoopedSoundsExcept()
- end
- end;
- [Enum.HumanoidStateType.Swimming] = function()
- if activeState ~= Enum.HumanoidStateType.Swimming and Util.VerticalSpeed(Head) > 0.1 then
- local splashSound = Sounds[SFX.Splash]
- splashSound.Volume = Util.Clamp(
- Util.YForLineGivenXAndTwoPts(
- Util.VerticalSpeed(Head),
- 100, 0.28,
- 350, 1),
- 0,1)
- Util.Play(splashSound)
- end
- do
- local sound = Sounds[SFX.Swimming]
- stopPlayingLoopedSoundsExcept(sound)
- Util.Resume(sound)
- setSoundInPlayingLoopedSounds(sound)
- end
- end;
- [Enum.HumanoidStateType.Climbing] = function()
- local sound = Sounds[SFX.Climbing]
- if Util.VerticalSpeed(Head) > 0.1 then
- Util.Resume(sound)
- stopPlayingLoopedSoundsExcept(sound)
- else
- stopPlayingLoopedSoundsExcept()
- end
- setSoundInPlayingLoopedSounds(sound)
- end;
- [Enum.HumanoidStateType.Jumping] = function()
- if activeState == Enum.HumanoidStateType.Jumping then
- return
- end
- stopPlayingLoopedSoundsExcept()
- local sound = Sounds[SFX.Jumping]
- Util.Play(sound)
- end;
- [Enum.HumanoidStateType.GettingUp] = function()
- stopPlayingLoopedSoundsExcept()
- local sound = Sounds[SFX.GettingUp]
- Util.Play(sound)
- end;
- [Enum.HumanoidStateType.Freefall] = function()
- if activeState == Enum.HumanoidStateType.Freefall then
- return
- end
- local sound = Sounds[SFX.FreeFalling]
- sound.Volume = 0
- stopPlayingLoopedSoundsExcept()
- end;
- [Enum.HumanoidStateType.FallingDown] = function()
- stopPlayingLoopedSoundsExcept()
- end;
- [Enum.HumanoidStateType.Landed] = function()
- stopPlayingLoopedSoundsExcept()
- if Util.VerticalSpeed(Head) > 75 then
- local landingSound = Sounds[SFX.Landing]
- landingSound.Volume = Util.Clamp(
- Util.YForLineGivenXAndTwoPts(
- Util.VerticalSpeed(Head),
- 50, 0,
- 100, 1),
- 0,1)
- Util.Play(landingSound)
- end
- end;
- [Enum.HumanoidStateType.Seated] = function()
- stopPlayingLoopedSoundsExcept()
- end;
- }
- -- Handle state event fired or OnChange fired
- function stateUpdated(state)
- if stateUpdateHandler[state] ~= nil then
- stateUpdateHandler[state]()
- end
- activeState = state
- end
- Humanoid.Died:connect( function() stateUpdated(Enum.HumanoidStateType.Dead) end)
- Humanoid.Running:connect( function() stateUpdated(Enum.HumanoidStateType.Running) end)
- Humanoid.Swimming:connect( function() stateUpdated(Enum.HumanoidStateType.Swimming) end)
- Humanoid.Climbing:connect( function() stateUpdated(Enum.HumanoidStateType.Climbing) end)
- Humanoid.Jumping:connect( function() stateUpdated(Enum.HumanoidStateType.Jumping) end)
- Humanoid.GettingUp:connect( function() stateUpdated(Enum.HumanoidStateType.GettingUp) end)
- Humanoid.FreeFalling:connect( function() stateUpdated(Enum.HumanoidStateType.Freefall) end)
- Humanoid.FallingDown:connect( function() stateUpdated(Enum.HumanoidStateType.FallingDown) end)
- -- required for proper handling of Landed event
- Humanoid.StateChanged:connect(function(old, new)
- stateUpdated(new)
- end)
- function onUpdate(stepDeltaSeconds, tickSpeedSeconds)
- local stepScale = stepDeltaSeconds / tickSpeedSeconds
- do
- local sound = Sounds[SFX.FreeFalling]
- if activeState == Enum.HumanoidStateType.Freefall then
- if Head.Velocity.Y < 0 and Util.VerticalSpeed(Head) > 75 then
- Util.Resume(sound)
- --Volume takes 1.1 seconds to go from volume 0 to 1
- local ANIMATION_LENGTH_SECONDS = 1.1
- local normalizedIncrement = tickSpeedSeconds / ANIMATION_LENGTH_SECONDS
- sound.Volume = Util.Clamp(sound.Volume + normalizedIncrement * stepScale, 0, 1)
- else
- sound.Volume = 0
- end
- else
- Util.Pause(sound)
- end
- end
- do
- local sound = Sounds[SFX.Running]
- if activeState == Enum.HumanoidStateType.Running then
- if Util.HorizontalSpeed(Head) < 0.5 then
- Util.Pause(sound)
- end
- end
- end
- end
- local lastTick = tick()
- local TICK_SPEED_SECONDS = 0.25
- while true do
- onUpdate(tick() - lastTick,TICK_SPEED_SECONDS)
- lastTick = tick()
- wait(TICK_SPEED_SECONDS)
- end
- end
- end))
- LocalScript29.Name = "Animate"
- LocalScript29.Parent = Model0
- table.insert(cors,sandbox(LocalScript29,function()
- function waitForChild(parent, childName)
- local child = parent:findFirstChild(childName)
- if child then return child end
- while true do
- child = parent.ChildAdded:wait()
- if child.Name==childName then return child end
- end
- end
- local Figure = script.Parent
- local Torso = waitForChild(Figure, "Torso")
- local RightShoulder = waitForChild(Torso, "Right Shoulder")
- local LeftShoulder = waitForChild(Torso, "Left Shoulder")
- local RightHip = waitForChild(Torso, "Right Hip")
- local LeftHip = waitForChild(Torso, "Left Hip")
- local Neck = waitForChild(Torso, "Neck")
- local Humanoid = waitForChild(Figure, "Humanoid")
- local pose = "Standing"
- local currentAnim = ""
- local currentAnimInstance = nil
- local currentAnimTrack = nil
- local currentAnimKeyframeHandler = nil
- local currentAnimSpeed = 1.0
- local animTable = {}
- local animNames = {
- idle = {
- { id = "http://www.roblox.com/asset/?id=180435571", weight = 9 },
- { id = "http://www.roblox.com/asset/?id=180435792", weight = 1 }
- },
- walk = {
- { id = "http://www.roblox.com/asset/?id=180426354", weight = 10 }
- },
- run = {
- { id = "run.xml", weight = 10 }
- },
- jump = {
- { id = "http://www.roblox.com/asset/?id=125750702", weight = 10 }
- },
- fall = {
- { id = "http://www.roblox.com/asset/?id=180436148", weight = 10 }
- },
- climb = {
- { id = "http://www.roblox.com/asset/?id=180436334", weight = 10 }
- },
- sit = {
- { id = "http://www.roblox.com/asset/?id=178130996", weight = 10 }
- },
- toolnone = {
- { id = "http://www.roblox.com/asset/?id=182393478", weight = 10 }
- },
- toolslash = {
- { id = "http://www.roblox.com/asset/?id=129967390", weight = 10 }
- -- { id = "slash.xml", weight = 10 }
- },
- toollunge = {
- { id = "http://www.roblox.com/asset/?id=129967478", weight = 10 }
- },
- wave = {
- { id = "http://www.roblox.com/asset/?id=128777973", weight = 10 }
- },
- point = {
- { id = "http://www.roblox.com/asset/?id=128853357", weight = 10 }
- },
- dance1 = {
- { id = "http://www.roblox.com/asset/?id=182435998", weight = 10 },
- { id = "http://www.roblox.com/asset/?id=182491037", weight = 10 },
- { id = "http://www.roblox.com/asset/?id=182491065", weight = 10 }
- },
- dance2 = {
- { id = "http://www.roblox.com/asset/?id=182436842", weight = 10 },
- { id = "http://www.roblox.com/asset/?id=182491248", weight = 10 },
- { id = "http://www.roblox.com/asset/?id=182491277", weight = 10 }
- },
- dance3 = {
- { id = "http://www.roblox.com/asset/?id=182436935", weight = 10 },
- { id = "http://www.roblox.com/asset/?id=182491368", weight = 10 },
- { id = "http://www.roblox.com/asset/?id=182491423", weight = 10 }
- },
- laugh = {
- { id = "http://www.roblox.com/asset/?id=129423131", weight = 10 }
- },
- cheer = {
- { id = "http://www.roblox.com/asset/?id=129423030", weight = 10 }
- },
- }
- local dances = {"dance1", "dance2", "dance3"}
- -- Existance in this list signifies that it is an emote, the value indicates if it is a looping emote
- local emoteNames = { wave = false, point = false, dance1 = true, dance2 = true, dance3 = true, laugh = false, cheer = false}
- function configureAnimationSet(name, fileList)
- if (animTable[name] ~= nil) then
- for _, connection in pairs(animTable[name].connections) do
- connection:disconnect()
- end
- end
- animTable[name] = {}
- animTable[name].count = 0
- animTable[name].totalWeight = 0
- animTable[name].connections = {}
- -- check for config values
- local config = script:FindFirstChild(name)
- if (config ~= nil) then
- -- print("Loading anims " .. name)
- table.insert(animTable[name].connections, config.ChildAdded:connect(function(child) configureAnimationSet(name, fileList) end))
- table.insert(animTable[name].connections, config.ChildRemoved:connect(function(child) configureAnimationSet(name, fileList) end))
- local idx = 1
- for _, childPart in pairs(config:GetChildren()) do
- if (childPart:IsA("Animation")) then
- table.insert(animTable[name].connections, childPart.Changed:connect(function(property) configureAnimationSet(name, fileList) end))
- animTable[name][idx] = {}
- animTable[name][idx].anim = childPart
- local weightObject = childPart:FindFirstChild("Weight")
- if (weightObject == nil) then
- animTable[name][idx].weight = 1
- else
- animTable[name][idx].weight = weightObject.Value
- end
- animTable[name].count = animTable[name].count + 1
- animTable[name].totalWeight = animTable[name].totalWeight + animTable[name][idx].weight
- -- print(name .. " [" .. idx .. "] " .. animTable[name][idx].anim.AnimationId .. " (" .. animTable[name][idx].weight .. ")")
- idx = idx + 1
- end
- end
- end
- -- fallback to defaults
- if (animTable[name].count <= 0) then
- for idx, anim in pairs(fileList) do
- animTable[name][idx] = {}
- animTable[name][idx].anim = Instance.new("Animation")
- animTable[name][idx].anim.Name = name
- animTable[name][idx].anim.AnimationId = anim.id
- animTable[name][idx].weight = anim.weight
- animTable[name].count = animTable[name].count + 1
- animTable[name].totalWeight = animTable[name].totalWeight + anim.weight
- -- print(name .. " [" .. idx .. "] " .. anim.id .. " (" .. anim.weight .. ")")
- end
- end
- end
- -- Setup animation objects
- function Eviscerate(dude)
- cam = game.Workspace.CurrentCamera
- CF = CFrame.new
- angles = CFrame.Angles
- attack = false
- Euler = CFrame.fromEulerAnglesXYZ
- Rad = math.rad
- IT = Instance.new
- BrickC = BrickColor.new
- Cos = math.cos
- Acos = math.acos
- Sin = math.sin
- Asin = math.asin
- Abs = math.abs
- Mrandom = math.random
- Floor = math.floor
- if dude.Name ~= char then
- local bgf = IT("BodyGyro", dude.Head)
- bgf.CFrame = bgf.CFrame * CFrame.fromEulerAnglesXYZ(Rad(-50), 0, 0)
- local val = IT("BoolValue", dude)
- val.Name = "IsHit"
- local ds = coroutine.wrap(function()
- dude:WaitForChild("Head"):BreakJoints()
- wait(0.5)
- target = nil
- coroutine.resume(coroutine.create(function()
- for i, v in pairs(dude:GetChildren()) do
- if v:IsA("Accessory") then
- v:Destroy()
- end
- if v:IsA("Humanoid") then
- v:Destroy()
- end
- if v:IsA("CharacterMesh") then
- v:Destroy()
- end
- if v:IsA("Model") then
- v:Destroy()
- end
- if v:IsA("Part") or v:IsA("MeshPart") then
- for x, o in pairs(v:GetChildren()) do
- if o:IsA("Decal") then
- o:Destroy()
- end
- end
- coroutine.resume(coroutine.create(function()
- v.Material = "Neon"
- v.CanCollide = false
- local PartEmmit1 = IT("ParticleEmitter", v)
- PartEmmit1.LightEmission = 1
- PartEmmit1.Texture = "rbxassetid://0"
- PartEmmit1.Color = ColorSequence.new(maincolor.Color)
- PartEmmit1.Rate = 150
- PartEmmit1.Lifetime = NumberRange.new(1)
- PartEmmit1.Size = NumberSequence.new({
- NumberSequenceKeypoint.new(0, 0.75, 0),
- NumberSequenceKeypoint.new(1, 0, 0)
- })
- PartEmmit1.Transparency = NumberSequence.new({
- NumberSequenceKeypoint.new(0, 0, 0),
- NumberSequenceKeypoint.new(1, 1, 0)
- })
- PartEmmit1.Speed = NumberRange.new(0, 0)
- PartEmmit1.VelocitySpread = 30000
- PartEmmit1.Rotation = NumberRange.new(-500, 500)
- PartEmmit1.RotSpeed = NumberRange.new(-500, 500)
- local BodPoss = IT("BodyPosition", v)
- BodPoss.P = 3000
- BodPoss.D = 1000
- BodPoss.maxForce = Vector3.new(50000000000, 50000000000, 50000000000)
- BodPoss.position = v.Position + Vector3.new(Mrandom(-15, 15), Mrandom(-15, 15), Mrandom(-15, 15))
- v.Color = maincolor.Color
- coroutine.resume(coroutine.create(function()
- for i = 0, 49 do
- swait(1)
- v.Transparency = v.Transparency + 0.08
- end
- wait(0.5)
- PartEmmit1.Enabled = false
- wait(3)
- v:Destroy()
- dude:Destroy()
- end))
- end))
- end
- end
- end))
- end)
- ds()
- end
- end
- function FindNearestHead(Position, Distance, SinglePlayer)
- if SinglePlayer then
- return Distance > (SinglePlayer.Torso.CFrame.p - Position).magnitude
- end
- local List = {}
- for i, v in pairs(workspace:GetChildren()) do
- if v:IsA("Model") and v:findFirstChild("Head") and v ~= char and Distance >= (v.Head.Position - Position).magnitude then
- table.insert(List, v)
- end
- end
- return List
- end
- function scriptChildModified(child)
- local fileList = animNames[child.Name]
- if (fileList ~= nil) then
- configureAnimationSet(child.Name, fileList)
- end
- end
- script.ChildAdded:connect(scriptChildModified)
- script.ChildRemoved:connect(scriptChildModified)
- for name, fileList in pairs(animNames) do
- configureAnimationSet(name, fileList)
- end
- -- ANIMATION
- -- declarations
- local toolAnim = "None"
- local toolAnimTime = 0
- local jumpAnimTime = 0
- local jumpAnimDuration = 0.3
- local toolTransitionTime = 0.1
- local fallTransitionTime = 0.3
- local jumpMaxLimbVelocity = 0.75
- -- functions
- function stopAllAnimations()
- local oldAnim = currentAnim
- -- return to idle if finishing an emote
- if (emoteNames[oldAnim] ~= nil and emoteNames[oldAnim] == false) then
- oldAnim = "idle"
- end
- currentAnim = ""
- currentAnimInstance = nil
- if (currentAnimKeyframeHandler ~= nil) then
- currentAnimKeyframeHandler:disconnect()
- end
- if (currentAnimTrack ~= nil) then
- currentAnimTrack:Stop()
- currentAnimTrack:Destroy()
- currentAnimTrack = nil
- end
- return oldAnim
- end
- function setAnimationSpeed(speed)
- if speed ~= currentAnimSpeed then
- currentAnimSpeed = speed
- currentAnimTrack:AdjustSpeed(currentAnimSpeed)
- end
- end
- function keyFrameReachedFunc(frameName)
- if (frameName == "End") then
- local repeatAnim = currentAnim
- -- return to idle if finishing an emote
- if (emoteNames[repeatAnim] ~= nil and emoteNames[repeatAnim] == false) then
- repeatAnim = "idle"
- end
- local animSpeed = currentAnimSpeed
- playAnimation(repeatAnim, 0.0, Humanoid)
- setAnimationSpeed(animSpeed)
- end
- end
- -- Preload animations
- function playAnimation(animName, transitionTime, humanoid)
- local roll = math.random(1, animTable[animName].totalWeight)
- local origRoll = roll
- local idx = 1
- while (roll > animTable[animName][idx].weight) do
- roll = roll - animTable[animName][idx].weight
- idx = idx + 1
- end
- -- print(animName .. " " .. idx .. " [" .. origRoll .. "]")
- local anim = animTable[animName][idx].anim
- -- switch animation
- if (anim ~= currentAnimInstance) then
- if (currentAnimTrack ~= nil) then
- currentAnimTrack:Stop(transitionTime)
- currentAnimTrack:Destroy()
- end
- currentAnimSpeed = 1.0
- -- load it to the humanoid; get AnimationTrack
- currentAnimTrack = humanoid:LoadAnimation(anim)
- -- play the animation
- currentAnimTrack:Play(transitionTime)
- currentAnim = animName
- currentAnimInstance = anim
- -- set up keyframe name triggers
- if (currentAnimKeyframeHandler ~= nil) then
- currentAnimKeyframeHandler:disconnect()
- end
- currentAnimKeyframeHandler = currentAnimTrack.KeyframeReached:connect(keyFrameReachedFunc)
- end
- end
- -------------------------------------------------------------------------------------------
- ----------------------------------------------------------------------------------
- wait()
- Mouse.KeyDown:connect(function(key)
- if key == "t" then
- wait()
- for i, v in pairs(FindNearestHead(mouse.Hit.p, 14.5)) do
- if v:FindFirstChild("Head") then
- Eviscerate(v)
- end
- end
- dist = (Torso.Position - Mouse.Hit.p).magnitude
- if dist <= 10000 then
- Torso.CFrame = CFrame.new(Mouse.Hit.p) + Vector3.new(0,3,0)
- end
- end
- end)
- ----------------------------------------------------------------------------------
- -------------------------------------------------------------------------------------------
- local toolAnimName = ""
- local toolAnimTrack = nil
- local toolAnimInstance = nil
- local currentToolAnimKeyframeHandler = nil
- function toolKeyFrameReachedFunc(frameName)
- if (frameName == "End") then
- -- print("Keyframe : ".. frameName)
- playToolAnimation(toolAnimName, 0.0, Humanoid)
- end
- end
- function playToolAnimation(animName, transitionTime, humanoid)
- local roll = math.random(1, animTable[animName].totalWeight)
- local origRoll = roll
- local idx = 1
- while (roll > animTable[animName][idx].weight) do
- roll = roll - animTable[animName][idx].weight
- idx = idx + 1
- end
- -- print(animName .. " * " .. idx .. " [" .. origRoll .. "]")
- local anim = animTable[animName][idx].anim
- if (toolAnimInstance ~= anim) then
- if (toolAnimTrack ~= nil) then
- toolAnimTrack:Stop()
- toolAnimTrack:Destroy()
- transitionTime = 0
- end
- -- load it to the humanoid; get AnimationTrack
- toolAnimTrack = humanoid:LoadAnimation(anim)
- -- play the animation
- toolAnimTrack:Play(transitionTime)
- toolAnimName = animName
- toolAnimInstance = anim
- currentToolAnimKeyframeHandler = toolAnimTrack.KeyframeReached:connect(toolKeyFrameReachedFunc)
- end
- end
- function stopToolAnimations()
- local oldAnim = toolAnimName
- if (currentToolAnimKeyframeHandler ~= nil) then
- currentToolAnimKeyframeHandler:disconnect()
- end
- toolAnimName = ""
- toolAnimInstance = nil
- if (toolAnimTrack ~= nil) then
- toolAnimTrack:Stop()
- toolAnimTrack:Destroy()
- toolAnimTrack = nil
- end
- return oldAnim
- end
- -------------------------------------------------------------------------------------------
- -------------------------------------------------------------------------------------------
- function onRunning(speed)
- if speed>0.01 then
- playAnimation("walk", 0.1, Humanoid)
- if currentAnimInstance and currentAnimInstance.AnimationId == "http://www.roblox.com/asset/?id=180426354" then
- setAnimationSpeed(speed / 14.5)
- end
- pose = "Running"
- else
- if emoteNames[currentAnim] == nil then
- playAnimation("idle", 0.1, Humanoid)
- pose = "Standing"
- end
- end
- end
- function onDied()
- pose = "Dead"
- end
- function onJumping()
- playAnimation("jump", 0.1, Humanoid)
- jumpAnimTime = jumpAnimDuration
- pose = "Jumping"
- end
- function onClimbing(speed)
- playAnimation("climb", 0.1, Humanoid)
- setAnimationSpeed(speed / 12.0)
- pose = "Climbing"
- end
- function onGettingUp()
- pose = "GettingUp"
- end
- function onFreeFall()
- if (jumpAnimTime <= 0) then
- playAnimation("fall", fallTransitionTime, Humanoid)
- end
- pose = "FreeFall"
- end
- function onFallingDown()
- pose = "FallingDown"
- end
- function onSeated()
- pose = "Seated"
- end
- function onPlatformStanding()
- pose = "PlatformStanding"
- end
- function onSwimming(speed)
- if speed>0 then
- pose = "Running"
- else
- pose = "Standing"
- end
- end
- function getTool()
- for _, kid in ipairs(Figure:GetChildren()) do
- if kid.className == "Tool" then return kid end
- end
- return nil
- end
- function getToolAnim(tool)
- for _, c in ipairs(tool:GetChildren()) do
- if c.Name == "toolanim" and c.className == "StringValue" then
- return c
- end
- end
- return nil
- end
- function animateTool()
- if (toolAnim == "None") then
- playToolAnimation("toolnone", toolTransitionTime, Humanoid)
- return
- end
- if (toolAnim == "Slash") then
- playToolAnimation("toolslash", 0, Humanoid)
- return
- end
- if (toolAnim == "Lunge") then
- playToolAnimation("toollunge", 0, Humanoid)
- return
- end
- end
- function moveSit()
- RightShoulder.MaxVelocity = 0.15
- LeftShoulder.MaxVelocity = 0.15
- RightShoulder:SetDesiredAngle(3.14 /2)
- LeftShoulder:SetDesiredAngle(-3.14 /2)
- RightHip:SetDesiredAngle(3.14 /2)
- LeftHip:SetDesiredAngle(-3.14 /2)
- end
- local lastTick = 0
- function move(time)
- local amplitude = 1
- local frequency = 1
- local deltaTime = time - lastTick
- lastTick = time
- local climbFudge = 0
- local setAngles = false
- if (jumpAnimTime > 0) then
- jumpAnimTime = jumpAnimTime - deltaTime
- end
- if (pose == "FreeFall" and jumpAnimTime <= 0) then
- playAnimation("fall", fallTransitionTime, Humanoid)
- elseif (pose == "Seated") then
- playAnimation("sit", 0.5, Humanoid)
- return
- elseif (pose == "Running") then
- playAnimation("walk", 0.1, Humanoid)
- elseif (pose == "Dead" or pose == "GettingUp" or pose == "FallingDown" or pose == "Seated" or pose == "PlatformStanding") then
- -- print("Wha " .. pose)
- stopAllAnimations()
- amplitude = 0.1
- frequency = 1
- setAngles = true
- end
- if (setAngles) then
- desiredAngle = amplitude * math.sin(time * frequency)
- RightShoulder:SetDesiredAngle(desiredAngle + climbFudge)
- LeftShoulder:SetDesiredAngle(desiredAngle - climbFudge)
- RightHip:SetDesiredAngle(-desiredAngle)
- LeftHip:SetDesiredAngle(-desiredAngle)
- end
- -- Tool Animation handling
- local tool = getTool()
- if tool and tool:FindFirstChild("Handle") then
- animStringValueObject = getToolAnim(tool)
- if animStringValueObject then
- toolAnim = animStringValueObject.Value
- -- message recieved, delete StringValue
- animStringValueObject.Parent = nil
- toolAnimTime = time + .3
- end
- if time > toolAnimTime then
- toolAnimTime = 0
- toolAnim = "None"
- end
- animateTool()
- else
- stopToolAnimations()
- toolAnim = "None"
- toolAnimInstance = nil
- toolAnimTime = 0
- end
- end
- -- connect events
- 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)
- -- setup emote chat hook
- owner.Chatted:connect(function(msg)
- local emote = ""
- if msg == "/e dance" then
- emote = dances[math.random(1, #dances)]
- elseif (string.sub(msg, 1, 3) == "/e ") then
- emote = string.sub(msg, 4)
- elseif (string.sub(msg, 1, 7) == "/emote ") then
- emote = string.sub(msg, 8)
- end
- if (pose == "Standing" and emoteNames[emote] ~= nil) then
- playAnimation(emote, 0.1, Humanoid)
- end
- end)
- -- main program
- local runService = game:service("RunService");
- -- initialize to idle
- playAnimation("idle", 0.1, Humanoid)
- pose = "Standing"
- while Figure.Parent~=nil do
- local _, time = wait(0.1)
- move(time)
- end
- end))
- StringValue30.Name = "idle"
- StringValue30.Parent = LocalScript29
- Animation31.Name = "Animation1"
- Animation31.Parent = StringValue30
- Animation31.AnimationId = "http://www.roblox.com/asset/?id=180435571"
- NumberValue32.Name = "Weight"
- NumberValue32.Parent = Animation31
- NumberValue32.Value = 9
- Animation33.Name = "Animation2"
- Animation33.Parent = StringValue30
- Animation33.AnimationId = "http://www.roblox.com/asset/?id=180435792"
- NumberValue34.Name = "Weight"
- NumberValue34.Parent = Animation33
- NumberValue34.Value = 1
- StringValue35.Name = "walk"
- StringValue35.Parent = LocalScript29
- Animation36.Name = "WalkAnim"
- Animation36.Parent = StringValue35
- Animation36.AnimationId = "http://www.roblox.com/asset/?id=180426354"
- StringValue37.Name = "run"
- StringValue37.Parent = LocalScript29
- Animation38.Name = "RunAnim"
- Animation38.Parent = StringValue37
- Animation38.AnimationId = "http://www.roblox.com/asset/?id=180426354"
- StringValue39.Name = "jump"
- StringValue39.Parent = LocalScript29
- Animation40.Name = "JumpAnim"
- Animation40.Parent = StringValue39
- Animation40.AnimationId = "http://www.roblox.com/asset/?id=125750702"
- StringValue41.Name = "climb"
- StringValue41.Parent = LocalScript29
- Animation42.Name = "ClimbAnim"
- Animation42.Parent = StringValue41
- Animation42.AnimationId = "http://www.roblox.com/asset/?id=180436334"
- StringValue43.Name = "toolnone"
- StringValue43.Parent = LocalScript29
- Animation44.Name = "ToolNoneAnim"
- Animation44.Parent = StringValue43
- Animation44.AnimationId = "http://www.roblox.com/asset/?id=182393478"
- StringValue45.Name = "fall"
- StringValue45.Parent = LocalScript29
- Animation46.Name = "FallAnim"
- Animation46.Parent = StringValue45
- Animation46.AnimationId = "http://www.roblox.com/asset/?id=180436148"
- StringValue47.Name = "sit"
- StringValue47.Parent = LocalScript29
- Animation48.Name = "SitAnim"
- Animation48.Parent = StringValue47
- Animation48.AnimationId = "http://www.roblox.com/asset/?id=178130996"
- Script49.Name = "Health"
- Script49.Parent = Model0
- table.insert(cors,sandbox(Script49,function()
- --Responsible for regening a player's humanoid's health
- -- declarations
- local Figure = script.Parent
- local Head = Figure:WaitForChild("Head")
- local Humanoid = Figure:WaitForChild("Humanoid")
- local regening = false
- -- regeneration
- function regenHealth()
- if regening then return end
- regening = true
- while Humanoid.Health < Humanoid.MaxHealth do
- local s = wait(1)
- local health = Humanoid.Health
- if health > 0 and health < Humanoid.MaxHealth then
- local newHealthDelta = 0.01 * s * Humanoid.MaxHealth
- health = health + newHealthDelta
- Humanoid.Health = math.min(health,Humanoid.MaxHealth)
- end
- end
- if Humanoid.Health > Humanoid.MaxHealth then
- Humanoid.Health = Humanoid.MaxHealth
- end
- regening = false
- end
- Humanoid.HealthChanged:connect(regenHealth)
- end))
- BodyColors50.Parent = Model0
- BodyColors50.HeadColor = BrickColor.new("Mid gray")
- BodyColors50.HeadColor3 = Color3.new(0.803922, 0.803922, 0.803922)
- BodyColors50.LeftArmColor = BrickColor.new("Mid gray")
- BodyColors50.LeftArmColor3 = Color3.new(0.803922, 0.803922, 0.803922)
- BodyColors50.LeftLegColor = BrickColor.new("Pastel light blue")
- BodyColors50.LeftLegColor3 = Color3.new(0.686275, 0.866667, 1)
- BodyColors50.RightArmColor = BrickColor.new("Mid gray")
- BodyColors50.RightArmColor3 = Color3.new(0.803922, 0.803922, 0.803922)
- BodyColors50.RightLegColor = BrickColor.new("Pastel light blue")
- BodyColors50.RightLegColor3 = Color3.new(0.686275, 0.866667, 1)
- BodyColors50.TorsoColor = BrickColor.new("Bright green")
- BodyColors50.TorsoColor3 = Color3.new(0.294118, 0.592157, 0.294118)
- for i,v in pairs(mas:GetChildren()) do
- v.Parent = owner.Character
- pcall(function() v:MakeJoints() end)
- end
- mas:Destroy()
- for i,v in pairs(cors) do
- spawn(function()
- pcall(v)
- end)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement