Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --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")
- Sound2 = Instance.new("Sound")
- RemoteEvent3 = Instance.new("RemoteEvent")
- Sound4 = Instance.new("Sound")
- RemoteEvent5 = Instance.new("RemoteEvent")
- Sound6 = Instance.new("Sound")
- RemoteEvent7 = Instance.new("RemoteEvent")
- Sound8 = Instance.new("Sound")
- RemoteEvent9 = Instance.new("RemoteEvent")
- Sound10 = Instance.new("Sound")
- RemoteEvent11 = Instance.new("RemoteEvent")
- Sound12 = Instance.new("Sound")
- RemoteEvent13 = Instance.new("RemoteEvent")
- Sound14 = Instance.new("Sound")
- RemoteEvent15 = Instance.new("RemoteEvent")
- Sound16 = Instance.new("Sound")
- RemoteEvent17 = Instance.new("RemoteEvent")
- Sound18 = Instance.new("Sound")
- RemoteEvent19 = Instance.new("RemoteEvent")
- SpecialMesh20 = Instance.new("SpecialMesh")
- Decal21 = Instance.new("Decal")
- Part22 = Instance.new("Part")
- Decal23 = Instance.new("Decal")
- Part24 = Instance.new("Part")
- Part25 = Instance.new("Part")
- Part26 = Instance.new("Part")
- Part27 = Instance.new("Part")
- Humanoid28 = Instance.new("Humanoid")
- Part29 = Instance.new("Part")
- Motor6D30 = Instance.new("Motor6D")
- Script31 = Instance.new("Script")
- LocalScript32 = Instance.new("LocalScript")
- Script33 = Instance.new("Script")
- LocalScript34 = Instance.new("LocalScript")
- StringValue35 = Instance.new("StringValue")
- Animation36 = Instance.new("Animation")
- NumberValue37 = Instance.new("NumberValue")
- Animation38 = Instance.new("Animation")
- NumberValue39 = Instance.new("NumberValue")
- StringValue40 = Instance.new("StringValue")
- Animation41 = Instance.new("Animation")
- StringValue42 = Instance.new("StringValue")
- Animation43 = Instance.new("Animation")
- StringValue44 = Instance.new("StringValue")
- Animation45 = Instance.new("Animation")
- StringValue46 = Instance.new("StringValue")
- Animation47 = Instance.new("Animation")
- StringValue48 = Instance.new("StringValue")
- Animation49 = Instance.new("Animation")
- StringValue50 = Instance.new("StringValue")
- Animation51 = Instance.new("Animation")
- StringValue52 = Instance.new("StringValue")
- Animation53 = Instance.new("Animation")
- Pants54 = Instance.new("Pants")
- Accessory55 = Instance.new("Accessory")
- Part56 = Instance.new("Part")
- SpecialMesh57 = Instance.new("SpecialMesh")
- CharacterMesh58 = Instance.new("CharacterMesh")
- Accessory59 = Instance.new("Accessory")
- Part60 = Instance.new("Part")
- SpecialMesh61 = Instance.new("SpecialMesh")
- Vector3Value62 = Instance.new("Vector3Value")
- Accessory63 = Instance.new("Accessory")
- Part64 = Instance.new("Part")
- SpecialMesh65 = Instance.new("SpecialMesh")
- Vector3Value66 = Instance.new("Vector3Value")
- CharacterMesh67 = Instance.new("CharacterMesh")
- Accessory68 = Instance.new("Accessory")
- Part69 = Instance.new("Part")
- SpecialMesh70 = Instance.new("SpecialMesh")
- Vector3Value71 = Instance.new("Vector3Value")
- CharacterMesh72 = Instance.new("CharacterMesh")
- CharacterMesh73 = Instance.new("CharacterMesh")
- CharacterMesh74 = Instance.new("CharacterMesh")
- Shirt75 = Instance.new("Shirt")
- Accessory76 = Instance.new("Accessory")
- Part77 = Instance.new("Part")
- SpecialMesh78 = Instance.new("SpecialMesh")
- Vector3Value79 = Instance.new("Vector3Value")
- Model80 = Instance.new("Model")
- Part81 = Instance.new("Part")
- SpecialMesh82 = Instance.new("SpecialMesh")
- Part83 = Instance.new("Part")
- Part84 = Instance.new("Part")
- Part85 = Instance.new("Part")
- Part86 = Instance.new("Part")
- Part87 = Instance.new("Part")
- Part88 = Instance.new("Part")
- Part89 = Instance.new("Part")
- Part90 = Instance.new("Part")
- Part91 = Instance.new("Part")
- Part92 = Instance.new("Part")
- Part93 = Instance.new("Part")
- Part94 = Instance.new("Part")
- Part95 = Instance.new("Part")
- Part96 = Instance.new("Part")
- Part97 = Instance.new("Part")
- Model98 = Instance.new("Model")
- Part99 = Instance.new("Part")
- SpecialMesh100 = Instance.new("SpecialMesh")
- Sound101 = Instance.new("Sound")
- RemoteEvent102 = Instance.new("RemoteEvent")
- Sound103 = Instance.new("Sound")
- RemoteEvent104 = Instance.new("RemoteEvent")
- Sound105 = Instance.new("Sound")
- RemoteEvent106 = Instance.new("RemoteEvent")
- Sound107 = Instance.new("Sound")
- RemoteEvent108 = Instance.new("RemoteEvent")
- Sound109 = Instance.new("Sound")
- RemoteEvent110 = Instance.new("RemoteEvent")
- Sound111 = Instance.new("Sound")
- RemoteEvent112 = Instance.new("RemoteEvent")
- Sound113 = Instance.new("Sound")
- RemoteEvent114 = Instance.new("RemoteEvent")
- Sound115 = Instance.new("Sound")
- RemoteEvent116 = Instance.new("RemoteEvent")
- Sound117 = Instance.new("Sound")
- RemoteEvent118 = Instance.new("RemoteEvent")
- Decal119 = Instance.new("Decal")
- Part120 = Instance.new("Part")
- Decal121 = Instance.new("Decal")
- Part122 = Instance.new("Part")
- Part123 = Instance.new("Part")
- Part124 = Instance.new("Part")
- Part125 = Instance.new("Part")
- Humanoid126 = Instance.new("Humanoid")
- Part127 = Instance.new("Part")
- Motor6D128 = Instance.new("Motor6D")
- Script129 = Instance.new("Script")
- LocalScript130 = Instance.new("LocalScript")
- Script131 = Instance.new("Script")
- LocalScript132 = Instance.new("LocalScript")
- StringValue133 = Instance.new("StringValue")
- Animation134 = Instance.new("Animation")
- NumberValue135 = Instance.new("NumberValue")
- Animation136 = Instance.new("Animation")
- NumberValue137 = Instance.new("NumberValue")
- StringValue138 = Instance.new("StringValue")
- Animation139 = Instance.new("Animation")
- StringValue140 = Instance.new("StringValue")
- Animation141 = Instance.new("Animation")
- StringValue142 = Instance.new("StringValue")
- Animation143 = Instance.new("Animation")
- StringValue144 = Instance.new("StringValue")
- Animation145 = Instance.new("Animation")
- StringValue146 = Instance.new("StringValue")
- Animation147 = Instance.new("Animation")
- StringValue148 = Instance.new("StringValue")
- Animation149 = Instance.new("Animation")
- StringValue150 = Instance.new("StringValue")
- Animation151 = Instance.new("Animation")
- Shirt152 = Instance.new("Shirt")
- Accessory153 = Instance.new("Accessory")
- Part154 = Instance.new("Part")
- SpecialMesh155 = Instance.new("SpecialMesh")
- Vector3Value156 = Instance.new("Vector3Value")
- Pants157 = Instance.new("Pants")
- Model0.Name = "Crystal5241"
- Model0.Parent = mas
- Model0.PrimaryPart = Part1
- Part1.Name = "Head"
- Part1.Parent = Model0
- Part1.BrickColor = BrickColor.new("CGA brown")
- Part1.Rotation = Vector3.new(52.4599991, 0, 0)
- Part1.Anchored = true
- Part1.Locked = true
- Part1.FormFactor = Enum.FormFactor.Symmetric
- Part1.Size = Vector3.new(2, 1, 1)
- Part1.CFrame = CFrame.new(0, 4.46677923, 0.278403997, 1, 0, 0, 0, 0.609307885, -0.792933822, 0, 0.792933822, 0.609307885)
- Part1.TopSurface = Enum.SurfaceType.Smooth
- Part1.Color = Color3.new(0.666667, 0.333333, 0)
- Part1.Position = Vector3.new(0, 4.46677923, 0.278403997)
- Part1.Orientation = Vector3.new(52.4599991, 0, 0)
- Part1.Color = Color3.new(0.666667, 0.333333, 0)
- Sound2.Name = "GettingUp"
- Sound2.Parent = Part1
- Sound2.SoundId = "rbxasset://sounds/action_get_up.mp3"
- Sound2.Volume = 0.64999997615814
- RemoteEvent3.Name = "CharacterSoundEvent"
- RemoteEvent3.Parent = Sound2
- Sound4.Name = "Died"
- Sound4.Parent = Part1
- Sound4.SoundId = "rbxasset://sounds/uuhhh.mp3"
- Sound4.Volume = 0.64999997615814
- RemoteEvent5.Name = "CharacterSoundEvent"
- RemoteEvent5.Parent = Sound4
- Sound6.Name = "FreeFalling"
- Sound6.Parent = Part1
- Sound6.SoundId = "rbxasset://sounds/action_falling.mp3"
- Sound6.TimePosition = 0.067105413782429
- Sound6.Volume = 0
- Sound6.Looped = true
- RemoteEvent7.Name = "CharacterSoundEvent"
- RemoteEvent7.Parent = Sound6
- Sound8.Name = "Jumping"
- Sound8.Parent = Part1
- Sound8.SoundId = "rbxasset://sounds/action_jump.mp3"
- Sound8.Volume = 0.64999997615814
- RemoteEvent9.Name = "CharacterSoundEvent"
- RemoteEvent9.Parent = Sound8
- Sound10.Name = "Landing"
- Sound10.Parent = Part1
- Sound10.SoundId = "rbxasset://sounds/action_jump_land.mp3"
- Sound10.Volume = 1
- RemoteEvent11.Name = "CharacterSoundEvent"
- RemoteEvent11.Parent = Sound10
- Sound12.Name = "Splash"
- Sound12.Parent = Part1
- Sound12.SoundId = "rbxasset://sounds/impact_water.mp3"
- Sound12.Volume = 0.64999997615814
- RemoteEvent13.Name = "CharacterSoundEvent"
- RemoteEvent13.Parent = Sound12
- Sound14.Name = "Running"
- Sound14.Parent = Part1
- Sound14.Pitch = 1.8500000238419
- Sound14.SoundId = "rbxasset://sounds/action_footsteps_plastic.mp3"
- Sound14.Volume = 0.64999997615814
- Sound14.Looped = true
- RemoteEvent15.Name = "CharacterSoundEvent"
- RemoteEvent15.Parent = Sound14
- Sound16.Name = "Swimming"
- Sound16.Parent = Part1
- Sound16.Pitch = 1.6000000238419
- Sound16.SoundId = "rbxasset://sounds/action_swim.mp3"
- Sound16.Volume = 0.64999997615814
- Sound16.Looped = true
- RemoteEvent17.Name = "CharacterSoundEvent"
- RemoteEvent17.Parent = Sound16
- Sound18.Name = "Climbing"
- Sound18.Parent = Part1
- Sound18.SoundId = "rbxasset://sounds/action_footsteps_plastic.mp3"
- Sound18.Volume = 0.64999997615814
- Sound18.Looped = true
- RemoteEvent19.Name = "CharacterSoundEvent"
- RemoteEvent19.Parent = Sound18
- SpecialMesh20.Parent = Part1
- SpecialMesh20.MeshId = "http://www.roblox.com/asset/?id=83001675"
- SpecialMesh20.Scale = Vector3.new(1.25, 1.25, 1.25)
- SpecialMesh20.MeshType = Enum.MeshType.FileMesh
- SpecialMesh20.Scale = Vector3.new(1.25, 1.25, 1.25)
- Decal21.Name = "face"
- Decal21.Parent = Part1
- Decal21.Texture = "http://www.roblox.com/asset/?id=144080495 "
- Part22.Name = "Torso"
- Part22.Parent = Model0
- Part22.BrickColor = BrickColor.new("CGA brown")
- Part22.Rotation = Vector3.new(8.72000027, 0, 0)
- Part22.Anchored = true
- Part22.Locked = true
- Part22.FormFactor = Enum.FormFactor.Symmetric
- Part22.Size = Vector3.new(2, 2, 1)
- Part22.CFrame = CFrame.new(0, 2.995543, 0.0448479988, 1, 0, 0, 0, 0.988437355, -0.151630059, 0, 0.151630059, 0.988437355)
- Part22.LeftSurface = Enum.SurfaceType.Weld
- Part22.RightSurface = Enum.SurfaceType.Weld
- Part22.Color = Color3.new(0.666667, 0.333333, 0)
- Part22.Position = Vector3.new(0, 2.995543, 0.0448479988)
- Part22.Orientation = Vector3.new(8.72000027, 0, 0)
- Part22.Color = Color3.new(0.666667, 0.333333, 0)
- Decal23.Name = "roblox"
- Decal23.Parent = Part22
- Part24.Name = "Left Arm"
- Part24.Parent = Model0
- Part24.BrickColor = BrickColor.new("CGA brown")
- Part24.Rotation = Vector3.new(39.4399986, 0, 0)
- Part24.Anchored = true
- Part24.CanCollide = false
- Part24.Locked = true
- Part24.FormFactor = Enum.FormFactor.Symmetric
- Part24.Size = Vector3.new(1, 2, 1)
- Part24.CFrame = CFrame.new(-1.5, 3.31320381, -0.341275781, 1, 0, 0, 0, 0.772247612, -0.635321677, 0, 0.635321677, 0.772247612)
- Part24.Color = Color3.new(0.666667, 0.333333, 0)
- Part24.Position = Vector3.new(-1.5, 3.31320381, -0.341275781)
- Part24.Orientation = Vector3.new(39.4399986, 0, 0)
- Part24.Color = Color3.new(0.666667, 0.333333, 0)
- Part25.Name = "Right Arm"
- Part25.Parent = Model0
- Part25.BrickColor = BrickColor.new("CGA brown")
- Part25.Rotation = Vector3.new(133.729996, 8.75, -12.4899998)
- Part25.Anchored = true
- Part25.CanCollide = false
- Part25.Locked = true
- Part25.FormFactor = Enum.FormFactor.Symmetric
- Part25.Size = Vector3.new(1, 2, 1)
- Part25.CFrame = CFrame.new(1.011567, 3.92417693, -0.99355799, 0.96496737, 0.213820562, 0.152048677, 0.256818086, -0.651179135, -0.714150012, -0.0536890179, 0.72818023, -0.683279574)
- Part25.Color = Color3.new(0.666667, 0.333333, 0)
- Part25.Position = Vector3.new(1.011567, 3.92417693, -0.99355799)
- Part25.Orientation = Vector3.new(45.5699997, 167.449997, 158.479996)
- Part25.Color = Color3.new(0.666667, 0.333333, 0)
- Part26.Name = "Left Leg"
- Part26.Parent = Model0
- Part26.BrickColor = BrickColor.new("CGA brown")
- Part26.Rotation = Vector3.new(-30.7299995, 0, 0)
- Part26.Anchored = true
- Part26.CanCollide = false
- Part26.Locked = true
- Part26.FormFactor = Enum.FormFactor.Symmetric
- Part26.Size = Vector3.new(1, 2, 1)
- Part26.CFrame = CFrame.new(-0.5, 1.09992146, 0.856665611, 1, 0, 0, 0, 0.859560609, 0.511033773, 0, -0.511033773, 0.859560609)
- Part26.BottomSurface = Enum.SurfaceType.Smooth
- Part26.Color = Color3.new(0.666667, 0.333333, 0)
- Part26.Position = Vector3.new(-0.5, 1.09992146, 0.856665611)
- Part26.Orientation = Vector3.new(-30.7299995, 0, 0)
- Part26.Color = Color3.new(0.666667, 0.333333, 0)
- Part27.Name = "Right Leg"
- Part27.Parent = Model0
- Part27.BrickColor = BrickColor.new("CGA brown")
- Part27.Rotation = Vector3.new(-16.8400002, 0, 0)
- Part27.Anchored = true
- Part27.CanCollide = false
- Part27.Locked = true
- Part27.FormFactor = Enum.FormFactor.Symmetric
- Part27.Size = Vector3.new(1, 2, 1)
- Part27.CFrame = CFrame.new(0.5, 1.16350722, 0.220150054, 1, 0, 0, 0, 0.957124233, 0.289678067, 0, -0.289678067, 0.957124233)
- Part27.BottomSurface = Enum.SurfaceType.Smooth
- Part27.Color = Color3.new(0.666667, 0.333333, 0)
- Part27.Position = Vector3.new(0.5, 1.16350722, 0.220150054)
- Part27.Orientation = Vector3.new(-16.8400002, 0, 0)
- Part27.Color = Color3.new(0.666667, 0.333333, 0)
- Humanoid28.Name = "Unkillable_Crystal5241"
- Humanoid28.Parent = Model0
- Humanoid28.RightLeg = Part27
- Humanoid28.LeftLeg = Part26
- Humanoid28.Torso = Part29
- Humanoid28.Health = inf
- Humanoid28.MaxHealth = inf
- Part29.Name = "HumanoidRootPart"
- Part29.Parent = Model0
- Part29.Transparency = 1
- Part29.Rotation = Vector3.new(8.72000027, 0, 0)
- Part29.Anchored = true
- Part29.CanCollide = false
- Part29.Locked = true
- Part29.FormFactor = Enum.FormFactor.Symmetric
- Part29.Size = Vector3.new(2, 2, 1)
- Part29.CFrame = CFrame.new(0, 2.995543, 0.0448479988, 1, 0, 0, 0, 0.988437355, -0.151630059, 0, 0.151630059, 0.988437355)
- Part29.BottomSurface = Enum.SurfaceType.Smooth
- Part29.TopSurface = Enum.SurfaceType.Smooth
- Part29.Position = Vector3.new(0, 2.995543, 0.0448479988)
- Part29.Orientation = Vector3.new(8.72000027, 0, 0)
- Motor6D30.Name = "RootJoint"
- Motor6D30.Parent = Part29
- Motor6D30.C0 = CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)
- Motor6D30.C1 = CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)
- Motor6D30.Part0 = Part29
- Motor6D30.Part1 = Part22
- Motor6D30.MaxVelocity = 0.10000000149012
- Script31.Name = "Sound"
- Script31.Parent = Model0
- table.insert(cors,sandbox(Script31,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.
- ]]--
- local ReplicatedStorage = game:GetService("ReplicatedStorage")
- local Players = game:GetService("Players")
- local SOUND_EVENT_FOLDER_NAME = "DefaultSoundEvents"
- local DEFAULT_SERVER_SOUND_EVENT_NAME = "DefaultServerSoundEvent"
- local SoundEventFolder = ReplicatedStorage:FindFirstChild(SOUND_EVENT_FOLDER_NAME)
- local DefaultServerSoundEvent = nil
- local useSoundDispatcher = UserSettings():IsUserFeatureEnabled("UserUseSoundDispatcher")
- if useSoundDispatcher then
- if not SoundEventFolder then
- SoundEventFolder = Instance.new("Folder")
- SoundEventFolder.Name = SOUND_EVENT_FOLDER_NAME
- SoundEventFolder.Archivable = false
- SoundEventFolder.Parent = ReplicatedStorage
- end
- DefaultServerSoundEvent = SoundEventFolder:FindFirstChild(DEFAULT_SERVER_SOUND_EVENT_NAME)
- else
- DefaultServerSoundEvent = ReplicatedStorage:FindFirstChild(DEFAULT_SERVER_SOUND_EVENT_NAME)
- end
- if not DefaultServerSoundEvent then
- if useSoundDispatcher then
- DefaultServerSoundEvent = Instance.new("RemoteEvent", SoundEventFolder)
- else
- DefaultServerSoundEvent = Instance.new("RemoteEvent", ReplicatedStorage)
- end
- DefaultServerSoundEvent.Name = DEFAULT_SERVER_SOUND_EVENT_NAME
- DefaultServerSoundEvent.OnServerEvent:Connect(function() end)
- end
- local function CreateNewSound(name, id, looped, pitch, parent)
- local sound = Instance.new("Sound")
- sound.SoundId = id
- sound.Name = name
- sound.archivable = false
- sound.Pitch = pitch
- sound.Looped = looped
- sound.MinDistance = 5
- sound.MaxDistance = 150
- sound.Volume = 0.65
- sound.Parent = parent
- if DefaultServerSoundEvent then
- local CharacterSoundEvent = Instance.new("RemoteEvent", sound)
- CharacterSoundEvent.Name = "CharacterSoundEvent"
- CharacterSoundEvent.OnServerEvent:Connect(function(player, playing, resetPosition)
- if type(playing) ~= "boolean" then
- return
- end
- if type(resetPosition) ~= "boolean" then
- return
- end
- if player.Character ~= script.Parent then
- return
- end
- for _, p in pairs(Players:GetPlayers()) do
- if p ~= player then
- -- Connect to the dispatcher to check if the player has loaded.
- if useSoundDispatcher then
- SoundEventFolder:FindFirstChild("SoundDispatcher"):Fire(p, sound, playing, resetPosition)
- else
- DefaultServerSoundEvent:FireClient(p, sound, playing, resetPosition)
- end
- end
- end
- end)
- end
- return sound
- end
- local head = script.Parent:FindFirstChild("Head")
- if not head 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))
- LocalScript32.Name = "LocalSound"
- LocalScript32.Parent = Script31
- table.insert(cors,sandbox(LocalScript32,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 useUpdatedLocalSoundFlag = UserSettings():IsUserFeatureEnabled("UserFixCharacterSoundIssues")
- local Humanoid = nil
- local Head = nil
- --SFX ID to Sound object
- local Sounds = {}
- local SoundService = game:GetService("SoundService")
- local soundEventFolderName = "DefaultSoundEvents"
- local ReplicatedStorage = game:GetService("ReplicatedStorage")
- local AddCharacterLoadedEvent = nil
- local RemoveCharacterEvent = nil
- local soundEventFolder = ReplicatedStorage:FindFirstChild(soundEventFolderName)
- local useSoundDispatcher = UserSettings():IsUserFeatureEnabled("UserUseSoundDispatcher")
- if useSoundDispatcher then
- if not soundEventFolder then
- soundEventFolder = Instance.new("Folder", ReplicatedStorage)
- soundEventFolder.Name = soundEventFolderName
- soundEventFolder.Archivable = false
- end
- -- Load the RemoveCharacterEvent
- RemoveCharacterEvent = soundEventFolder:FindFirstChild("RemoveCharacterEvent")
- if RemoveCharacterEvent == nil then
- RemoveCharacterEvent = Instance.new("RemoteEvent", soundEventFolder)
- RemoveCharacterEvent.Name = "RemoveCharacterEvent"
- end
- AddCharacterLoadedEvent = soundEventFolder:FindFirstChild("AddCharacterLoadedEvent")
- if AddCharacterLoadedEvent == nil then
- AddCharacterLoadedEvent = Instance.new("RemoteEvent", soundEventFolder)
- AddCharacterLoadedEvent.Name = "AddCharacterLoadedEvent"
- end
- -- Notify the server a new character has been loaded
- AddCharacterLoadedEvent:FireServer()
- -- Notify the sound dispatcher this character has left.
- game.Players.LocalPlayer.CharacterRemoving:connect(function(character)
- RemoveCharacterEvent:FireServer(game.Players.LocalPlayer)
- end)
- end
- 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
- if Humanoid then break 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")
- local DefaultServerSoundEvent = nil
- if useSoundDispatcher then
- DefaultServerSoundEvent = soundEventFolder:FindFirstChild("DefaultServerSoundEvent")
- else
- DefaultServerSoundEvent = game:GetService("ReplicatedStorage"):FindFirstChild("DefaultServerSoundEvent")
- end
- if DefaultServerSoundEvent then
- DefaultServerSoundEvent.OnClientEvent:connect(function(sound, playing, resetPosition)
- if UserSettings():IsUserFeatureEnabled("UserPlayCharacterLoopSoundWhenFE") then
- if resetPosition and sound.TimePosition ~= 0 then
- sound.TimePosition = 0
- end
- if sound.IsPlaying ~= playing then
- sound.Playing = playing
- end
- else
- if sound.TimePosition ~= 0 then
- sound.TimePosition = 0
- end
- if not sound.IsPlaying then
- sound.Playing = true
- end
- end
- end)
- end
- end
- local IsSoundFilteringEnabled = function()
- return game.Workspace.FilteringEnabled and SoundService.RespectFilteringEnabled
- 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 IsSoundFilteringEnabled() then
- sound.CharacterSoundEvent:FireServer(true, true)
- end
- if sound.TimePosition ~= 0 then
- sound.TimePosition = 0
- end
- if not sound.IsPlaying then
- sound.Playing = true
- end
- end;
- Pause = function(sound)
- if UserSettings():IsUserFeatureEnabled("UserPlayCharacterLoopSoundWhenFE") and IsSoundFilteringEnabled() then
- sound.CharacterSoundEvent:FireServer(false, false)
- end
- if sound.IsPlaying then
- sound.Playing = false
- end
- end;
- Resume = function(sound)
- if UserSettings():IsUserFeatureEnabled("UserPlayCharacterLoopSoundWhenFE") and IsSoundFilteringEnabled() then
- sound.CharacterSoundEvent:FireServer(true, false)
- end
- if not sound.IsPlaying then
- sound.Playing = true
- end
- end;
- Stop = function(sound)
- if UserSettings():IsUserFeatureEnabled("UserPlayCharacterLoopSoundWhenFE") and IsSoundFilteringEnabled() then
- sound.CharacterSoundEvent:FireServer(false, true)
- end
- 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
- local fallSpeed = 0
- -- 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(speed)
- stateUpdated(Enum.HumanoidStateType.Running, speed)
- end;
- [Enum.HumanoidStateType.Running] = function(speed)
- local sound = Sounds[SFX.Running]
- stopPlayingLoopedSoundsExcept(sound)
- if(useUpdatedLocalSoundFlag and activeState == Enum.HumanoidStateType.Freefall and fallSpeed > 0.1) then
- -- Play a landing sound if the character dropped from a large distance
- local vol = math.min(1.0, math.max(0.0, (fallSpeed - 50) / 110))
- local freeFallSound = Sounds[SFX.FreeFalling]
- freeFallSound.Volume = vol
- Util.Play(freeFallSound)
- fallSpeed = 0
- end
- if useUpdatedLocalSoundFlag then
- if speed ~= nil and speed > 0.5 then
- Util.Resume(sound)
- setSoundInPlayingLoopedSounds(sound)
- elseif speed ~= nil then
- stopPlayingLoopedSoundsExcept()
- end
- else
- if Util.HorizontalSpeed(Head) > 0.5 then
- Util.Resume(sound)
- setSoundInPlayingLoopedSounds(sound)
- else
- stopPlayingLoopedSoundsExcept()
- end
- end
- end;
- [Enum.HumanoidStateType.Swimming] = function(speed)
- local threshold
- if useUpdatedLocalSoundFlag then threshold = speed else threshold = Util.VerticalSpeed(Head) end
- if activeState ~= Enum.HumanoidStateType.Swimming and threshold > 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(speed)
- local sound = Sounds[SFX.Climbing]
- if useUpdatedLocalSoundFlag then
- if speed ~= nil and math.abs(speed) > 0.1 then
- Util.Resume(sound)
- stopPlayingLoopedSoundsExcept(sound)
- else
- Util.Pause(sound)
- stopPlayingLoopedSoundsExcept(sound)
- end
- else
- if Util.VerticalSpeed(Head) > 0.1 then
- Util.Resume(sound)
- stopPlayingLoopedSoundsExcept(sound)
- else
- stopPlayingLoopedSoundsExcept()
- end
- 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()
- fallSpeed = math.max(fallSpeed, math.abs(Head.Velocity.y))
- 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, speed)
- if stateUpdateHandler[state] ~= nil then
- if useUpdatedLocalSoundFlag and (state == Enum.HumanoidStateType.Running
- or state == Enum.HumanoidStateType.Climbing
- or state == Enum.HumanoidStateType.Swimming
- or state == Enum.HumanoidStateType.RunningNoPhysics) then
- stateUpdateHandler[state](speed)
- else
- stateUpdateHandler[state]()
- end
- end
- activeState = state
- end
- Humanoid.Died:connect( function() stateUpdated(Enum.HumanoidStateType.Dead) end)
- Humanoid.Running:connect( function(speed) stateUpdated(Enum.HumanoidStateType.Running, speed) end)
- Humanoid.Swimming:connect( function(speed) stateUpdated(Enum.HumanoidStateType.Swimming, speed) end)
- Humanoid.Climbing:connect( function(speed) stateUpdated(Enum.HumanoidStateType.Climbing, speed) 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))
- Script33.Name = "Health"
- Script33.Parent = Model0
- table.insert(cors,sandbox(Script33,function()
- -- Gradually regenerates the Humanoid's Health over time.
- local REGEN_RATE = 1/100 -- Regenerate this fraction of MaxHealth per second.
- local REGEN_STEP = 1 -- Wait this long between each regeneration step.
- --------------------------------------------------------------------------------
- local Character = script.Parent
- local Humanoid = Character:WaitForChild'Humanoid'
- --------------------------------------------------------------------------------
- while true do
- while Humanoid.Health < Humanoid.MaxHealth do
- local dt = wait(REGEN_STEP)
- local dh = dt*REGEN_RATE*Humanoid.MaxHealth
- Humanoid.Health = math.min(Humanoid.Health + dh, Humanoid.MaxHealth)
- end
- Humanoid.HealthChanged:Wait()
- end
- end))
- LocalScript34.Name = "Animate"
- LocalScript34.Parent = Model0
- table.insert(cors,sandbox(LocalScript34,function()
- local Figure = script.Parent
- local Torso = Figure:WaitForChild("Torso")
- local RightShoulder = Torso:WaitForChild("Right Shoulder")
- local LeftShoulder = Torso:WaitForChild("Left Shoulder")
- local RightHip = Torso:WaitForChild("Right Hip")
- local LeftHip = Torso:WaitForChild("Left Hip")
- local Neck = Torso:WaitForChild("Neck")
- local Humanoid = Figure:WaitForChild("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 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)
- currentAnimTrack.Priority = Enum.AnimationPriority.Core
- -- 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
- -------------------------------------------------------------------------------------------
- -------------------------------------------------------------------------------------------
- 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, priority)
- 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)
- if priority then
- toolAnimTrack.Priority = priority
- end
- -- 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, Enum.AnimationPriority.Idle)
- return
- end
- if (toolAnim == "Slash") then
- playToolAnimation("toolslash", 0, Humanoid, Enum.AnimationPriority.Action)
- return
- end
- if (toolAnim == "Lunge") then
- playToolAnimation("toollunge", 0, Humanoid, Enum.AnimationPriority.Action)
- 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
- local 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
- local 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
- game:GetService("Players").LocalPlayer.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
- -- initialize to idle
- playAnimation("idle", 0.1, Humanoid)
- pose = "Standing"
- while Figure.Parent ~= nil do
- local _, time = wait(0.1)
- move(time)
- end
- end))
- StringValue35.Name = "idle"
- StringValue35.Parent = LocalScript34
- Animation36.Name = "Animation1"
- Animation36.Parent = StringValue35
- Animation36.AnimationId = "http://www.roblox.com/asset/?id=180435571"
- NumberValue37.Name = "Weight"
- NumberValue37.Parent = Animation36
- NumberValue37.Value = 9
- Animation38.Name = "Animation2"
- Animation38.Parent = StringValue35
- Animation38.AnimationId = "http://www.roblox.com/asset/?id=180435792"
- NumberValue39.Name = "Weight"
- NumberValue39.Parent = Animation38
- NumberValue39.Value = 1
- StringValue40.Name = "walk"
- StringValue40.Parent = LocalScript34
- Animation41.Name = "WalkAnim"
- Animation41.Parent = StringValue40
- Animation41.AnimationId = "http://www.roblox.com/asset/?id=180426354"
- StringValue42.Name = "run"
- StringValue42.Parent = LocalScript34
- Animation43.Name = "RunAnim"
- Animation43.Parent = StringValue42
- Animation43.AnimationId = "http://www.roblox.com/asset/?id=180426354"
- StringValue44.Name = "jump"
- StringValue44.Parent = LocalScript34
- Animation45.Name = "JumpAnim"
- Animation45.Parent = StringValue44
- Animation45.AnimationId = "http://www.roblox.com/asset/?id=125750702"
- StringValue46.Name = "climb"
- StringValue46.Parent = LocalScript34
- Animation47.Name = "ClimbAnim"
- Animation47.Parent = StringValue46
- Animation47.AnimationId = "http://www.roblox.com/asset/?id=180436334"
- StringValue48.Name = "toolnone"
- StringValue48.Parent = LocalScript34
- Animation49.Name = "ToolNoneAnim"
- Animation49.Parent = StringValue48
- Animation49.AnimationId = "http://www.roblox.com/asset/?id=182393478"
- StringValue50.Name = "fall"
- StringValue50.Parent = LocalScript34
- Animation51.Name = "FallAnim"
- Animation51.Parent = StringValue50
- Animation51.AnimationId = "http://www.roblox.com/asset/?id=180436148"
- StringValue52.Name = "sit"
- StringValue52.Parent = LocalScript34
- Animation53.Name = "SitAnim"
- Animation53.Parent = StringValue52
- Animation53.AnimationId = "http://www.roblox.com/asset/?id=178130996"
- Pants54.Name = "Pants"
- Pants54.Parent = Model0
- Pants54.PantsTemplate = "http://www.roblox.com/asset/?id=1515127652"
- Accessory55.Name = "Necklace"
- Accessory55.Parent = Model0
- Accessory55.AttachmentPos = Vector3.new(0, 0.980000019, 0)
- Part56.Name = "Handle"
- Part56.Parent = Accessory55
- Part56.Rotation = Vector3.new(51.4799995, 0, 0)
- Part56.Anchored = true
- Part56.CanCollide = false
- Part56.Locked = true
- Part56.FormFactor = Enum.FormFactor.Symmetric
- Part56.Size = Vector3.new(1, 1, 2)
- Part56.CFrame = CFrame.new(0, 3.99185872, 0.118275687, 1, 0, 0, 0, 0.622849047, -0.782342136, 0, 0.782342136, 0.622849047)
- Part56.BottomSurface = Enum.SurfaceType.Smooth
- Part56.TopSurface = Enum.SurfaceType.Smooth
- Part56.Position = Vector3.new(0, 3.99185872, 0.118275687)
- Part56.Orientation = Vector3.new(51.4799995, 0, 0)
- SpecialMesh57.Parent = Part56
- SpecialMesh57.MeshId = "http://www.roblox.com/asset/?id=28461516"
- SpecialMesh57.Scale = Vector3.new(1.14999998, 1.14999998, 1.25)
- SpecialMesh57.TextureId = "http://www.roblox.com/asset/?id=376188163 "
- SpecialMesh57.MeshType = Enum.MeshType.FileMesh
- SpecialMesh57.Scale = Vector3.new(1.14999998, 1.14999998, 1.25)
- CharacterMesh58.Parent = Model0
- CharacterMesh58.MeshId = 27111894
- CharacterMesh58.BodyPart = Enum.BodyPart.Torso
- Accessory59.Name = "ThorHelmet"
- Accessory59.Parent = Model0
- Accessory59.AttachmentPos = Vector3.new(0, -0.150000006, 0.0250000004)
- Part60.Name = "Handle"
- Part60.Parent = Accessory59
- Part60.Rotation = Vector3.new(51.4799995, 0, 0)
- Part60.Anchored = true
- Part60.CanCollide = false
- Part60.Locked = true
- Part60.FormFactor = Enum.FormFactor.Custom
- Part60.Size = Vector3.new(1.80000019, 0.670001626, 2.00000024)
- Part60.CFrame = CFrame.new(0, 4.78483105, 0.554270208, 1, 0, 0, 0, 0.622849047, -0.782342136, 0, 0.782342136, 0.622849047)
- Part60.BottomSurface = Enum.SurfaceType.Smooth
- Part60.TopSurface = Enum.SurfaceType.Smooth
- Part60.Position = Vector3.new(0, 4.78483105, 0.554270208)
- Part60.Orientation = Vector3.new(51.4799995, 0, 0)
- SpecialMesh61.Parent = Part60
- SpecialMesh61.MeshId = "rbxassetid://1076180901"
- SpecialMesh61.TextureId = "rbxassetid://1076181316"
- SpecialMesh61.MeshType = Enum.MeshType.FileMesh
- Vector3Value62.Name = "OriginalSize"
- Vector3Value62.Parent = Part60
- Vector3Value62.Value = Vector3.new(1.80000019, 0.670001626, 2.00000024)
- Accessory63.Name = "Bandana"
- Accessory63.Parent = Model0
- Accessory63.AttachmentPos = Vector3.new(0, 0.800000012, 0)
- Part64.Name = "Handle"
- Part64.Parent = Accessory63
- Part64.Rotation = Vector3.new(51.4799995, 0, 0)
- Part64.Anchored = true
- Part64.CanCollide = false
- Part64.Locked = true
- Part64.FormFactor = Enum.FormFactor.Symmetric
- Part64.Size = Vector3.new(1, 1, 1)
- Part64.CFrame = CFrame.new(0, 4.20605421, -0.0905775428, 1, 0, 0, 0, 0.622849047, -0.782342136, 0, 0.782342136, 0.622849047)
- Part64.BottomSurface = Enum.SurfaceType.Smooth
- Part64.TopSurface = Enum.SurfaceType.Smooth
- Part64.Position = Vector3.new(0, 4.20605421, -0.0905775428)
- Part64.Orientation = Vector3.new(51.4799995, 0, 0)
- SpecialMesh65.Parent = Part64
- SpecialMesh65.MeshId = "http://www.roblox.com/asset/?id=20637493"
- SpecialMesh65.Scale = Vector3.new(1, 0.899999976, 1)
- SpecialMesh65.TextureId = "http://www.roblox.com/asset/?id=20637003"
- SpecialMesh65.MeshType = Enum.MeshType.FileMesh
- SpecialMesh65.Scale = Vector3.new(1, 0.899999976, 1)
- Vector3Value66.Name = "OriginalSize"
- Vector3Value66.Parent = Part64
- Vector3Value66.Value = Vector3.new(1, 1, 1)
- CharacterMesh67.Parent = Model0
- CharacterMesh67.MeshId = 27111419
- CharacterMesh67.BodyPart = Enum.BodyPart.LeftArm
- Accessory68.Name = "RobloxVisor"
- Accessory68.Parent = Model0
- Accessory68.AttachmentPos = Vector3.new(0, 0.0500000007, 0.200000003)
- Part69.Name = "Handle"
- Part69.Parent = Accessory68
- Part69.Rotation = Vector3.new(51.4799995, 0, 0)
- Part69.Anchored = true
- Part69.CanCollide = false
- Part69.Locked = true
- Part69.FormFactor = Enum.FormFactor.Symmetric
- Part69.Size = Vector3.new(1.33000004, 1, 1.5)
- Part69.CFrame = CFrame.new(0, 4.99831915, 0.422895133, 1, 0, 0, 0, 0.622849047, -0.782342136, 0, 0.782342136, 0.622849047)
- Part69.BottomSurface = Enum.SurfaceType.Smooth
- Part69.TopSurface = Enum.SurfaceType.Smooth
- Part69.Position = Vector3.new(0, 4.99831915, 0.422895133)
- Part69.Orientation = Vector3.new(51.4799995, 0, 0)
- SpecialMesh70.Parent = Part69
- SpecialMesh70.MeshId = "http://www.roblox.com/asset/?id=264715302 "
- SpecialMesh70.Scale = Vector3.new(1.20000005, 1.20000005, 1.20000005)
- SpecialMesh70.TextureId = "http://www.roblox.com/asset/?id=607960560"
- SpecialMesh70.MeshType = Enum.MeshType.FileMesh
- SpecialMesh70.Scale = Vector3.new(1.20000005, 1.20000005, 1.20000005)
- Vector3Value71.Name = "OriginalSize"
- Vector3Value71.Parent = Part69
- Vector3Value71.Value = Vector3.new(1.33000004, 1, 1.5)
- CharacterMesh72.Name = "Roblox 2.0 Right Arm"
- CharacterMesh72.Parent = Model0
- CharacterMesh72.MeshId = 27111864
- CharacterMesh72.BodyPart = Enum.BodyPart.RightArm
- CharacterMesh73.Parent = Model0
- CharacterMesh73.MeshId = 27111857
- CharacterMesh73.BodyPart = Enum.BodyPart.LeftLeg
- CharacterMesh74.Parent = Model0
- CharacterMesh74.MeshId = 27111882
- CharacterMesh74.BodyPart = Enum.BodyPart.RightLeg
- Shirt75.Name = "Shirt"
- Shirt75.Parent = Model0
- Shirt75.ShirtTemplate = "http://www.roblox.com/asset/?id=1176813991"
- Accessory76.Name = "PurpleHair"
- Accessory76.Parent = Model0
- Accessory76.AttachmentPos = Vector3.new(0, 0.340000004, 0.25)
- Part77.Name = "Handle"
- Part77.Parent = Accessory76
- Part77.Rotation = Vector3.new(51.4799995, 0, 0)
- Part77.Anchored = true
- Part77.CanCollide = false
- Part77.Locked = true
- Part77.FormFactor = Enum.FormFactor.Custom
- Part77.Size = Vector3.new(1.60002756, 0.800000012, 1.59999776)
- Part77.CFrame = CFrame.new(0, 4.77948141, 0.661035657, 1, 0, 0, 0, 0.622849047, -0.782342136, 0, 0.782342136, 0.622849047)
- Part77.BottomSurface = Enum.SurfaceType.Smooth
- Part77.TopSurface = Enum.SurfaceType.Smooth
- Part77.Position = Vector3.new(0, 4.77948141, 0.661035657)
- Part77.Orientation = Vector3.new(51.4799995, 0, 0)
- SpecialMesh78.Parent = Part77
- SpecialMesh78.MeshId = "rbxassetid://667528488"
- SpecialMesh78.TextureId = "rbxassetid://845828015"
- SpecialMesh78.MeshType = Enum.MeshType.FileMesh
- Vector3Value79.Name = "OriginalSize"
- Vector3Value79.Parent = Part77
- Vector3Value79.Value = Vector3.new(1.60002756, 0.800000012, 1.59999776)
- Model80.Parent = mas
- Part81.Name = "Handle"
- Part81.Parent = Model80
- Part81.BrickColor = BrickColor.new("Dark stone grey")
- Part81.Reflectance = 0.40000000596046
- Part81.Rotation = Vector3.new(-58.4499969, -11.6999998, 84.6699982)
- Part81.Anchored = true
- Part81.Locked = true
- Part81.FormFactor = Enum.FormFactor.Plate
- Part81.Size = Vector3.new(1, 0.800000012, 4)
- Part81.CFrame = CFrame.new(0.443211198, 5.71565056, -1.17533004, 0.0910439938, -0.974978328, -0.202801108, 0.537021935, -0.123431161, 0.834489167, -0.838640869, -0.184883863, 0.512347043)
- Part81.BottomSurface = Enum.SurfaceType.Smooth
- Part81.TopSurface = Enum.SurfaceType.Smooth
- Part81.Color = Color3.new(0.388235, 0.372549, 0.384314)
- Part81.Position = Vector3.new(0.443211198, 5.71565056, -1.17533004)
- Part81.Orientation = Vector3.new(-56.5599976, -21.6000004, 102.939995)
- Part81.Color = Color3.new(0.388235, 0.372549, 0.384314)
- SpecialMesh82.Parent = Part81
- SpecialMesh82.MeshId = "rbxasset://fonts/sword.mesh"
- SpecialMesh82.TextureId = "rbxasset://textures/SwordTexture.png"
- SpecialMesh82.MeshType = Enum.MeshType.FileMesh
- Part83.Parent = Model80
- Part83.Material = Enum.Material.Wood
- Part83.BrickColor = BrickColor.new("Dark orange")
- Part83.Rotation = Vector3.new(-11.46, 0, 0)
- Part83.Anchored = true
- Part83.Shape = Enum.PartType.Cylinder
- Part83.Size = Vector3.new(0.25, 0.700000048, 0.899999976)
- Part83.CFrame = CFrame.new(1.5, 7.01640511, -0.963681042, 1, 0, 0, 0, 0.98007524, 0.19862704, 0, -0.19862704, 0.98007524)
- Part83.BottomSurface = Enum.SurfaceType.Smooth
- Part83.TopSurface = Enum.SurfaceType.Smooth
- Part83.Color = Color3.new(0.627451, 0.372549, 0.207843)
- Part83.Position = Vector3.new(1.5, 7.01640511, -0.963681042)
- Part83.Orientation = Vector3.new(-11.46, 0, 0)
- Part83.Color = Color3.new(0.627451, 0.372549, 0.207843)
- Part84.Parent = Model80
- Part84.Material = Enum.Material.Wood
- Part84.BrickColor = BrickColor.new("Dark orange")
- Part84.Rotation = Vector3.new(-11.46, 0, 0)
- Part84.Anchored = true
- Part84.Shape = Enum.PartType.Cylinder
- Part84.Size = Vector3.new(0.25, 0.700000048, 0.899999976)
- Part84.CFrame = CFrame.new(1, 7.01640511, -0.963681042, 1, 0, 0, 0, 0.98007524, 0.19862704, 0, -0.19862704, 0.98007524)
- Part84.BottomSurface = Enum.SurfaceType.Smooth
- Part84.TopSurface = Enum.SurfaceType.Smooth
- Part84.Color = Color3.new(0.627451, 0.372549, 0.207843)
- Part84.Position = Vector3.new(1, 7.01640511, -0.963681042)
- Part84.Orientation = Vector3.new(-11.46, 0, 0)
- Part84.Color = Color3.new(0.627451, 0.372549, 0.207843)
- Part85.Parent = Model80
- Part85.Material = Enum.Material.Wood
- Part85.BrickColor = BrickColor.new("Dark orange")
- Part85.Rotation = Vector3.new(-11.46, 0, 0)
- Part85.Anchored = true
- Part85.Shape = Enum.PartType.Cylinder
- Part85.Size = Vector3.new(0.25, 0.5, 0.5)
- Part85.CFrame = CFrame.new(1.25, 7.00648022, -1.01268113, 1, 0, 0, 0, 0.98007524, 0.19862704, 0, -0.19862704, 0.98007524)
- Part85.BottomSurface = Enum.SurfaceType.Smooth
- Part85.TopSurface = Enum.SurfaceType.Smooth
- Part85.Color = Color3.new(0.627451, 0.372549, 0.207843)
- Part85.Position = Vector3.new(1.25, 7.00648022, -1.01268113)
- Part85.Orientation = Vector3.new(-11.46, 0, 0)
- Part85.Color = Color3.new(0.627451, 0.372549, 0.207843)
- Part86.Parent = Model80
- Part86.Material = Enum.Material.Wood
- Part86.BrickColor = BrickColor.new("Dark orange")
- Part86.Rotation = Vector3.new(-11.46, 0, 0)
- Part86.Anchored = true
- Part86.Shape = Enum.PartType.Cylinder
- Part86.Size = Vector3.new(0.25, 0.700000048, 0.899999976)
- Part86.CFrame = CFrame.new(0.5, 7.01640511, -0.963681042, 1, 0, 0, 0, 0.98007524, 0.19862704, 0, -0.19862704, 0.98007524)
- Part86.BottomSurface = Enum.SurfaceType.Smooth
- Part86.TopSurface = Enum.SurfaceType.Smooth
- Part86.Color = Color3.new(0.627451, 0.372549, 0.207843)
- Part86.Position = Vector3.new(0.5, 7.01640511, -0.963681042)
- Part86.Orientation = Vector3.new(-11.46, 0, 0)
- Part86.Color = Color3.new(0.627451, 0.372549, 0.207843)
- Part87.Parent = Model80
- Part87.Material = Enum.Material.Wood
- Part87.BrickColor = BrickColor.new("Dark orange")
- Part87.Rotation = Vector3.new(-11.46, 0, 0)
- Part87.Anchored = true
- Part87.Shape = Enum.PartType.Cylinder
- Part87.Size = Vector3.new(0.25, 0.5, 0.5)
- Part87.CFrame = CFrame.new(0.75, 7.00648022, -1.01268113, 1, 0, 0, 0, 0.98007524, 0.19862704, 0, -0.19862704, 0.98007524)
- Part87.BottomSurface = Enum.SurfaceType.Smooth
- Part87.TopSurface = Enum.SurfaceType.Smooth
- Part87.Color = Color3.new(0.627451, 0.372549, 0.207843)
- Part87.Position = Vector3.new(0.75, 7.00648022, -1.01268113)
- Part87.Orientation = Vector3.new(-11.46, 0, 0)
- Part87.Color = Color3.new(0.627451, 0.372549, 0.207843)
- Part88.Parent = Model80
- Part88.Material = Enum.Material.Wood
- Part88.BrickColor = BrickColor.new("Dark orange")
- Part88.Rotation = Vector3.new(-11.46, 0, 0)
- Part88.Anchored = true
- Part88.Shape = Enum.PartType.Cylinder
- Part88.Size = Vector3.new(0.25, 0.5, 0.5)
- Part88.CFrame = CFrame.new(0.25, 7.00648022, -1.01268113, 1, 0, 0, 0, 0.98007524, 0.19862704, 0, -0.19862704, 0.98007524)
- Part88.BottomSurface = Enum.SurfaceType.Smooth
- Part88.TopSurface = Enum.SurfaceType.Smooth
- Part88.Color = Color3.new(0.627451, 0.372549, 0.207843)
- Part88.Position = Vector3.new(0.25, 7.00648022, -1.01268113)
- Part88.Orientation = Vector3.new(-11.46, 0, 0)
- Part88.Color = Color3.new(0.627451, 0.372549, 0.207843)
- Part89.Parent = Model80
- Part89.Material = Enum.Material.Wood
- Part89.BrickColor = BrickColor.new("Dark orange")
- Part89.Rotation = Vector3.new(-11.46, 0, 0)
- Part89.Anchored = true
- Part89.Shape = Enum.PartType.Cylinder
- Part89.Size = Vector3.new(0.25, 0.700000048, 0.899999976)
- Part89.CFrame = CFrame.new(0, 7.01640511, -0.963681042, 1, 0, 0, 0, 0.98007524, 0.19862704, 0, -0.19862704, 0.98007524)
- Part89.BottomSurface = Enum.SurfaceType.Smooth
- Part89.TopSurface = Enum.SurfaceType.Smooth
- Part89.Color = Color3.new(0.627451, 0.372549, 0.207843)
- Part89.Position = Vector3.new(0, 7.01640511, -0.963681042)
- Part89.Orientation = Vector3.new(-11.46, 0, 0)
- Part89.Color = Color3.new(0.627451, 0.372549, 0.207843)
- Part90.Parent = Model80
- Part90.Material = Enum.Material.Wood
- Part90.BrickColor = BrickColor.new("Dark orange")
- Part90.Rotation = Vector3.new(-11.46, 0, 0)
- Part90.Anchored = true
- Part90.Shape = Enum.PartType.Cylinder
- Part90.Size = Vector3.new(0.25, 0.700000048, 0.899999976)
- Part90.CFrame = CFrame.new(-0.5, 7.01640511, -0.963681042, 1, 0, 0, 0, 0.98007524, 0.19862704, 0, -0.19862704, 0.98007524)
- Part90.BottomSurface = Enum.SurfaceType.Smooth
- Part90.TopSurface = Enum.SurfaceType.Smooth
- Part90.Color = Color3.new(0.627451, 0.372549, 0.207843)
- Part90.Position = Vector3.new(-0.5, 7.01640511, -0.963681042)
- Part90.Orientation = Vector3.new(-11.46, 0, 0)
- Part90.Color = Color3.new(0.627451, 0.372549, 0.207843)
- Part91.Parent = Model80
- Part91.Material = Enum.Material.Wood
- Part91.BrickColor = BrickColor.new("Dark orange")
- Part91.Rotation = Vector3.new(-11.46, 0, 0)
- Part91.Anchored = true
- Part91.Shape = Enum.PartType.Cylinder
- Part91.Size = Vector3.new(0.25, 0.5, 0.5)
- Part91.CFrame = CFrame.new(-0.25, 7.00648022, -1.01268113, 1, 0, 0, 0, 0.98007524, 0.19862704, 0, -0.19862704, 0.98007524)
- Part91.BottomSurface = Enum.SurfaceType.Smooth
- Part91.TopSurface = Enum.SurfaceType.Smooth
- Part91.Color = Color3.new(0.627451, 0.372549, 0.207843)
- Part91.Position = Vector3.new(-0.25, 7.00648022, -1.01268113)
- Part91.Orientation = Vector3.new(-11.46, 0, 0)
- Part91.Color = Color3.new(0.627451, 0.372549, 0.207843)
- Part92.Parent = Model80
- Part92.Material = Enum.Material.Wood
- Part92.BrickColor = BrickColor.new("Dark orange")
- Part92.Rotation = Vector3.new(-11.46, 0, 0)
- Part92.Anchored = true
- Part92.Shape = Enum.PartType.Cylinder
- Part92.Size = Vector3.new(0.25, 0.5, 0.5)
- Part92.CFrame = CFrame.new(-0.75, 7.00648022, -1.01268113, 1, 0, 0, 0, 0.98007524, 0.19862704, 0, -0.19862704, 0.98007524)
- Part92.BottomSurface = Enum.SurfaceType.Smooth
- Part92.TopSurface = Enum.SurfaceType.Smooth
- Part92.Color = Color3.new(0.627451, 0.372549, 0.207843)
- Part92.Position = Vector3.new(-0.75, 7.00648022, -1.01268113)
- Part92.Orientation = Vector3.new(-11.46, 0, 0)
- Part92.Color = Color3.new(0.627451, 0.372549, 0.207843)
- Part93.Parent = Model80
- Part93.Material = Enum.Material.Wood
- Part93.BrickColor = BrickColor.new("Dark orange")
- Part93.Rotation = Vector3.new(-11.46, 0, 0)
- Part93.Anchored = true
- Part93.Shape = Enum.PartType.Cylinder
- Part93.Size = Vector3.new(0.25, 0.700000048, 0.899999976)
- Part93.CFrame = CFrame.new(-1, 7.01640511, -0.963681042, 1, 0, 0, 0, 0.98007524, 0.19862704, 0, -0.19862704, 0.98007524)
- Part93.BottomSurface = Enum.SurfaceType.Smooth
- Part93.TopSurface = Enum.SurfaceType.Smooth
- Part93.Color = Color3.new(0.627451, 0.372549, 0.207843)
- Part93.Position = Vector3.new(-1, 7.01640511, -0.963681042)
- Part93.Orientation = Vector3.new(-11.46, 0, 0)
- Part93.Color = Color3.new(0.627451, 0.372549, 0.207843)
- Part94.Parent = Model80
- Part94.Material = Enum.Material.Wood
- Part94.BrickColor = BrickColor.new("Dark orange")
- Part94.Rotation = Vector3.new(-11.46, 0, 0)
- Part94.Anchored = true
- Part94.Shape = Enum.PartType.Cylinder
- Part94.Size = Vector3.new(0.25, 0.5, 0.5)
- Part94.CFrame = CFrame.new(-1.25, 7.00648022, -1.01268113, 1, 0, 0, 0, 0.98007524, 0.19862704, 0, -0.19862704, 0.98007524)
- Part94.BottomSurface = Enum.SurfaceType.Smooth
- Part94.TopSurface = Enum.SurfaceType.Smooth
- Part94.Color = Color3.new(0.627451, 0.372549, 0.207843)
- Part94.Position = Vector3.new(-1.25, 7.00648022, -1.01268113)
- Part94.Orientation = Vector3.new(-11.46, 0, 0)
- Part94.Color = Color3.new(0.627451, 0.372549, 0.207843)
- Part95.Parent = Model80
- Part95.Material = Enum.Material.Wood
- Part95.BrickColor = BrickColor.new("Dark orange")
- Part95.Rotation = Vector3.new(-11.46, 0, 0)
- Part95.Anchored = true
- Part95.Shape = Enum.PartType.Cylinder
- Part95.Size = Vector3.new(0.25, 0.700000048, 0.899999976)
- Part95.CFrame = CFrame.new(-1.5, 7.01640511, -0.963681042, 1, 0, 0, 0, 0.98007524, 0.19862704, 0, -0.19862704, 0.98007524)
- Part95.BottomSurface = Enum.SurfaceType.Smooth
- Part95.TopSurface = Enum.SurfaceType.Smooth
- Part95.Color = Color3.new(0.627451, 0.372549, 0.207843)
- Part95.Position = Vector3.new(-1.5, 7.01640511, -0.963681042)
- Part95.Orientation = Vector3.new(-11.46, 0, 0)
- Part95.Color = Color3.new(0.627451, 0.372549, 0.207843)
- Part96.Parent = Model80
- Part96.Material = Enum.Material.Wood
- Part96.BrickColor = BrickColor.new("Dark orange")
- Part96.Rotation = Vector3.new(-11.46, 0, 0)
- Part96.Anchored = true
- Part96.Shape = Enum.PartType.Cylinder
- Part96.Size = Vector3.new(0.25, 0.700000048, 0.899999976)
- Part96.CFrame = CFrame.new(1.75, 7.01640511, -0.963681042, 1, 0, 0, 0, 0.98007524, 0.19862704, 0, -0.19862704, 0.98007524)
- Part96.BottomSurface = Enum.SurfaceType.Smooth
- Part96.TopSurface = Enum.SurfaceType.Smooth
- Part96.Color = Color3.new(0.627451, 0.372549, 0.207843)
- Part96.Position = Vector3.new(1.75, 7.01640511, -0.963681042)
- Part96.Orientation = Vector3.new(-11.46, 0, 0)
- Part96.Color = Color3.new(0.627451, 0.372549, 0.207843)
- Part97.Parent = Model80
- Part97.Material = Enum.Material.Wood
- Part97.BrickColor = BrickColor.new("Dark orange")
- Part97.Rotation = Vector3.new(-11.46, 0, 0)
- Part97.Anchored = true
- Part97.Shape = Enum.PartType.Cylinder
- Part97.Size = Vector3.new(0.25, 0.700000048, 0.899999976)
- Part97.CFrame = CFrame.new(-1.75, 7.01640511, -0.963681042, 1, 0, 0, 0, 0.98007524, 0.19862704, 0, -0.19862704, 0.98007524)
- Part97.BottomSurface = Enum.SurfaceType.Smooth
- Part97.TopSurface = Enum.SurfaceType.Smooth
- Part97.Color = Color3.new(0.627451, 0.372549, 0.207843)
- Part97.Position = Vector3.new(-1.75, 7.01640511, -0.963681042)
- Part97.Orientation = Vector3.new(-11.46, 0, 0)
- Part97.Color = Color3.new(0.627451, 0.372549, 0.207843)
- Model98.Name = "reset4852258"
- Model98.Parent = mas
- Model98.PrimaryPart = Part99
- Part99.Name = "Head"
- Part99.Parent = Model98
- Part99.BrickColor = BrickColor.new("Light orange")
- Part99.Rotation = Vector3.new(-168.229996, 0, 0)
- Part99.Anchored = true
- Part99.Locked = true
- Part99.FormFactor = Enum.FormFactor.Symmetric
- Part99.Size = Vector3.new(2, 1, 1)
- Part99.CFrame = CFrame.new(3.93465438e-09, 8.50928497, -1.9829061, 1, 7.87137555e-09, -3.26223034e-24, 7.70596742e-09, -0.978986144, 0.203927025, 1.60518621e-09, -0.203927025, -0.978986144)
- Part99.TopSurface = Enum.SurfaceType.Smooth
- Part99.Color = Color3.new(0.917647, 0.721569, 0.572549)
- Part99.Position = Vector3.new(3.93465438e-09, 8.50928497, -1.9829061)
- Part99.Orientation = Vector3.new(-11.7699995, -180, 180)
- Part99.Color = Color3.new(0.917647, 0.721569, 0.572549)
- SpecialMesh100.Parent = Part99
- SpecialMesh100.Scale = Vector3.new(1.25, 1.25, 1.25)
- SpecialMesh100.Scale = Vector3.new(1.25, 1.25, 1.25)
- Sound101.Name = "GettingUp"
- Sound101.Parent = Part99
- Sound101.SoundId = "rbxasset://sounds/action_get_up.mp3"
- Sound101.Volume = 0.64999997615814
- RemoteEvent102.Name = "CharacterSoundEvent"
- RemoteEvent102.Parent = Sound101
- Sound103.Name = "Died"
- Sound103.Parent = Part99
- Sound103.SoundId = "rbxasset://sounds/uuhhh.mp3"
- Sound103.Volume = 0.64999997615814
- RemoteEvent104.Name = "CharacterSoundEvent"
- RemoteEvent104.Parent = Sound103
- Sound105.Name = "FreeFalling"
- Sound105.Parent = Part99
- Sound105.SoundId = "rbxasset://sounds/action_falling.mp3"
- Sound105.TimePosition = 0.033058470674973
- Sound105.Volume = 0.25191351771355
- Sound105.Looped = true
- RemoteEvent106.Name = "CharacterSoundEvent"
- RemoteEvent106.Parent = Sound105
- Sound107.Name = "Jumping"
- Sound107.Parent = Part99
- Sound107.SoundId = "rbxasset://sounds/action_jump.mp3"
- Sound107.Volume = 0.64999997615814
- RemoteEvent108.Name = "CharacterSoundEvent"
- RemoteEvent108.Parent = Sound107
- Sound109.Name = "Landing"
- Sound109.Parent = Part99
- Sound109.SoundId = "rbxasset://sounds/action_jump_land.mp3"
- Sound109.Volume = 1
- RemoteEvent110.Name = "CharacterSoundEvent"
- RemoteEvent110.Parent = Sound109
- Sound111.Name = "Splash"
- Sound111.Parent = Part99
- Sound111.SoundId = "rbxasset://sounds/impact_water.mp3"
- Sound111.Volume = 0.64999997615814
- RemoteEvent112.Name = "CharacterSoundEvent"
- RemoteEvent112.Parent = Sound111
- Sound113.Name = "Running"
- Sound113.Parent = Part99
- Sound113.Pitch = 1.8500000238419
- Sound113.SoundId = "rbxasset://sounds/action_footsteps_plastic.mp3"
- Sound113.Volume = 0.64999997615814
- Sound113.Looped = true
- RemoteEvent114.Name = "CharacterSoundEvent"
- RemoteEvent114.Parent = Sound113
- Sound115.Name = "Swimming"
- Sound115.Parent = Part99
- Sound115.Pitch = 1.6000000238419
- Sound115.SoundId = "rbxasset://sounds/action_swim.mp3"
- Sound115.Volume = 0.64999997615814
- Sound115.Looped = true
- RemoteEvent116.Name = "CharacterSoundEvent"
- RemoteEvent116.Parent = Sound115
- Sound117.Name = "Climbing"
- Sound117.Parent = Part99
- Sound117.SoundId = "rbxasset://sounds/action_footsteps_plastic.mp3"
- Sound117.Volume = 0.64999997615814
- Sound117.Looped = true
- RemoteEvent118.Name = "CharacterSoundEvent"
- RemoteEvent118.Parent = Sound117
- Decal119.Name = "face"
- Decal119.Parent = Part99
- Decal119.Texture = "http://www.roblox.com/asset/?id=14861556"
- Part120.Name = "Torso"
- Part120.Parent = Model98
- Part120.BrickColor = BrickColor.new("Light orange")
- Part120.Rotation = Vector3.new(-142.720001, 0, 0)
- Part120.Anchored = true
- Part120.Locked = true
- Part120.FormFactor = Enum.FormFactor.Symmetric
- Part120.Size = Vector3.new(2, 2, 1)
- Part120.CFrame = CFrame.new(0, 9.46127796, -0.917588115, 1, 0, 0, 0, -0.795691371, 0.605702281, 0, -0.605702281, -0.795691371)
- Part120.LeftSurface = Enum.SurfaceType.Weld
- Part120.RightSurface = Enum.SurfaceType.Weld
- Part120.Color = Color3.new(0.917647, 0.721569, 0.572549)
- Part120.Position = Vector3.new(0, 9.46127796, -0.917588115)
- Part120.Orientation = Vector3.new(-37.2799988, 180, 180)
- Part120.Color = Color3.new(0.917647, 0.721569, 0.572549)
- Decal121.Name = "roblox"
- Decal121.Parent = Part120
- Part122.Name = "Left Arm"
- Part122.Parent = Model98
- Part122.BrickColor = BrickColor.new("Light orange")
- Part122.Rotation = Vector3.new(-11.46, 0, 0)
- Part122.Anchored = true
- Part122.CanCollide = false
- Part122.Locked = true
- Part122.FormFactor = Enum.FormFactor.Symmetric
- Part122.Size = Vector3.new(1, 2, 1)
- Part122.CFrame = CFrame.new(-1.5, 8.32946014, -1.2405709, 1, 0, 0, 0, 0.98007524, 0.19862704, 0, -0.19862704, 0.98007524)
- Part122.Color = Color3.new(0.917647, 0.721569, 0.572549)
- Part122.Position = Vector3.new(-1.5, 8.32946014, -1.2405709)
- Part122.Orientation = Vector3.new(-11.46, 0, 0)
- Part122.Color = Color3.new(0.917647, 0.721569, 0.572549)
- Part123.Name = "Right Arm"
- Part123.Parent = Model98
- Part123.BrickColor = BrickColor.new("Light orange")
- Part123.Rotation = Vector3.new(-9.59000015, 0, 0)
- Part123.Anchored = true
- Part123.CanCollide = false
- Part123.Locked = true
- Part123.FormFactor = Enum.FormFactor.Symmetric
- Part123.Size = Vector3.new(1, 2, 1)
- Part123.CFrame = CFrame.new(1.5, 8.38019943, -1.26994395, 1, 0, 0, 0, 0.98603034, 0.166566059, 0, -0.166566059, 0.98603034)
- Part123.Color = Color3.new(0.917647, 0.721569, 0.572549)
- Part123.Position = Vector3.new(1.5, 8.38019943, -1.26994395)
- Part123.Orientation = Vector3.new(-9.59000015, 0, 0)
- Part123.Color = Color3.new(0.917647, 0.721569, 0.572549)
- Part124.Name = "Left Leg"
- Part124.Parent = Model98
- Part124.BrickColor = BrickColor.new("Light orange")
- Part124.Rotation = Vector3.new(143.770004, 0, 0)
- Part124.Anchored = true
- Part124.CanCollide = false
- Part124.Locked = true
- Part124.FormFactor = Enum.FormFactor.Symmetric
- Part124.Size = Vector3.new(1, 2, 1)
- Part124.CFrame = CFrame.new(-0.5, 11.1632748, -0.655006409, 1, 0, 0, 0, -0.806658268, -0.59101826, 0, 0.59101826, -0.806658268)
- Part124.BottomSurface = Enum.SurfaceType.Smooth
- Part124.Color = Color3.new(0.917647, 0.721569, 0.572549)
- Part124.Position = Vector3.new(-0.5, 11.1632748, -0.655006409)
- Part124.Orientation = Vector3.new(36.2299995, 180, 180)
- Part124.Color = Color3.new(0.917647, 0.721569, 0.572549)
- Part125.Name = "Right Leg"
- Part125.Parent = Model98
- Part125.BrickColor = BrickColor.new("Light orange")
- Part125.Rotation = Vector3.new(145.020004, 0, 0)
- Part125.Anchored = true
- Part125.CanCollide = false
- Part125.Locked = true
- Part125.FormFactor = Enum.FormFactor.Symmetric
- Part125.Size = Vector3.new(1, 2, 1)
- Part125.CFrame = CFrame.new(0.5, 11.2412996, -0.570427716, 1, 0, 0, 0, -0.819374979, -0.573257983, 0, 0.573257983, -0.819374979)
- Part125.BottomSurface = Enum.SurfaceType.Smooth
- Part125.Color = Color3.new(0.917647, 0.721569, 0.572549)
- Part125.Position = Vector3.new(0.5, 11.2412996, -0.570427716)
- Part125.Orientation = Vector3.new(34.9799995, 180, 180)
- Part125.Color = Color3.new(0.917647, 0.721569, 0.572549)
- Humanoid126.Name = "Unkillable_reset4852258"
- Humanoid126.Parent = Model98
- Humanoid126.RightLeg = Part125
- Humanoid126.LeftLeg = Part124
- Humanoid126.Torso = Part127
- Humanoid126.Health = inf
- Humanoid126.MaxHealth = inf
- Part127.Name = "HumanoidRootPart"
- Part127.Parent = Model98
- Part127.Transparency = 1
- Part127.Rotation = Vector3.new(-142.720001, 0, 0)
- Part127.Anchored = true
- Part127.CanCollide = false
- Part127.Locked = true
- Part127.FormFactor = Enum.FormFactor.Symmetric
- Part127.Size = Vector3.new(2, 2, 1)
- Part127.CFrame = CFrame.new(0, 9.46127796, -0.917588115, 1, 0, 0, 0, -0.795691371, 0.605702281, 0, -0.605702281, -0.795691371)
- Part127.BottomSurface = Enum.SurfaceType.Smooth
- Part127.TopSurface = Enum.SurfaceType.Smooth
- Part127.Position = Vector3.new(0, 9.46127796, -0.917588115)
- Part127.Orientation = Vector3.new(-37.2799988, 180, 180)
- Motor6D128.Name = "RootJoint"
- Motor6D128.Parent = Part127
- Motor6D128.C0 = CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)
- Motor6D128.C1 = CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)
- Motor6D128.Part0 = Part127
- Motor6D128.Part1 = Part120
- Motor6D128.MaxVelocity = 0.10000000149012
- Script129.Name = "Sound"
- Script129.Parent = Model98
- table.insert(cors,sandbox(Script129,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.
- ]]--
- local ReplicatedStorage = game:GetService("ReplicatedStorage")
- local Players = game:GetService("Players")
- local SOUND_EVENT_FOLDER_NAME = "DefaultSoundEvents"
- local DEFAULT_SERVER_SOUND_EVENT_NAME = "DefaultServerSoundEvent"
- local SoundEventFolder = ReplicatedStorage:FindFirstChild(SOUND_EVENT_FOLDER_NAME)
- local DefaultServerSoundEvent = nil
- local useSoundDispatcher = UserSettings():IsUserFeatureEnabled("UserUseSoundDispatcher")
- if useSoundDispatcher then
- if not SoundEventFolder then
- SoundEventFolder = Instance.new("Folder")
- SoundEventFolder.Name = SOUND_EVENT_FOLDER_NAME
- SoundEventFolder.Archivable = false
- SoundEventFolder.Parent = ReplicatedStorage
- end
- DefaultServerSoundEvent = SoundEventFolder:FindFirstChild(DEFAULT_SERVER_SOUND_EVENT_NAME)
- else
- DefaultServerSoundEvent = ReplicatedStorage:FindFirstChild(DEFAULT_SERVER_SOUND_EVENT_NAME)
- end
- if not DefaultServerSoundEvent then
- if useSoundDispatcher then
- DefaultServerSoundEvent = Instance.new("RemoteEvent", SoundEventFolder)
- else
- DefaultServerSoundEvent = Instance.new("RemoteEvent", ReplicatedStorage)
- end
- DefaultServerSoundEvent.Name = DEFAULT_SERVER_SOUND_EVENT_NAME
- DefaultServerSoundEvent.OnServerEvent:Connect(function() end)
- end
- local function CreateNewSound(name, id, looped, pitch, parent)
- local sound = Instance.new("Sound")
- sound.SoundId = id
- sound.Name = name
- sound.archivable = false
- sound.Pitch = pitch
- sound.Looped = looped
- sound.MinDistance = 5
- sound.MaxDistance = 150
- sound.Volume = 0.65
- sound.Parent = parent
- if DefaultServerSoundEvent then
- local CharacterSoundEvent = Instance.new("RemoteEvent", sound)
- CharacterSoundEvent.Name = "CharacterSoundEvent"
- CharacterSoundEvent.OnServerEvent:Connect(function(player, playing, resetPosition)
- if type(playing) ~= "boolean" then
- return
- end
- if type(resetPosition) ~= "boolean" then
- return
- end
- if player.Character ~= script.Parent then
- return
- end
- for _, p in pairs(Players:GetPlayers()) do
- if p ~= player then
- -- Connect to the dispatcher to check if the player has loaded.
- if useSoundDispatcher then
- SoundEventFolder:FindFirstChild("SoundDispatcher"):Fire(p, sound, playing, resetPosition)
- else
- DefaultServerSoundEvent:FireClient(p, sound, playing, resetPosition)
- end
- end
- end
- end)
- end
- return sound
- end
- local head = script.Parent:FindFirstChild("Head")
- if not head 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))
- LocalScript130.Name = "LocalSound"
- LocalScript130.Parent = Script129
- table.insert(cors,sandbox(LocalScript130,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 useUpdatedLocalSoundFlag = UserSettings():IsUserFeatureEnabled("UserFixCharacterSoundIssues")
- local Humanoid = nil
- local Head = nil
- --SFX ID to Sound object
- local Sounds = {}
- local SoundService = game:GetService("SoundService")
- local soundEventFolderName = "DefaultSoundEvents"
- local ReplicatedStorage = game:GetService("ReplicatedStorage")
- local AddCharacterLoadedEvent = nil
- local RemoveCharacterEvent = nil
- local soundEventFolder = ReplicatedStorage:FindFirstChild(soundEventFolderName)
- local useSoundDispatcher = UserSettings():IsUserFeatureEnabled("UserUseSoundDispatcher")
- if useSoundDispatcher then
- if not soundEventFolder then
- soundEventFolder = Instance.new("Folder", ReplicatedStorage)
- soundEventFolder.Name = soundEventFolderName
- soundEventFolder.Archivable = false
- end
- -- Load the RemoveCharacterEvent
- RemoveCharacterEvent = soundEventFolder:FindFirstChild("RemoveCharacterEvent")
- if RemoveCharacterEvent == nil then
- RemoveCharacterEvent = Instance.new("RemoteEvent", soundEventFolder)
- RemoveCharacterEvent.Name = "RemoveCharacterEvent"
- end
- AddCharacterLoadedEvent = soundEventFolder:FindFirstChild("AddCharacterLoadedEvent")
- if AddCharacterLoadedEvent == nil then
- AddCharacterLoadedEvent = Instance.new("RemoteEvent", soundEventFolder)
- AddCharacterLoadedEvent.Name = "AddCharacterLoadedEvent"
- end
- -- Notify the server a new character has been loaded
- AddCharacterLoadedEvent:FireServer()
- -- Notify the sound dispatcher this character has left.
- game.Players.LocalPlayer.CharacterRemoving:connect(function(character)
- RemoveCharacterEvent:FireServer(game.Players.LocalPlayer)
- end)
- end
- 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
- if Humanoid then break 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")
- local DefaultServerSoundEvent = nil
- if useSoundDispatcher then
- DefaultServerSoundEvent = soundEventFolder:FindFirstChild("DefaultServerSoundEvent")
- else
- DefaultServerSoundEvent = game:GetService("ReplicatedStorage"):FindFirstChild("DefaultServerSoundEvent")
- end
- if DefaultServerSoundEvent then
- DefaultServerSoundEvent.OnClientEvent:connect(function(sound, playing, resetPosition)
- if UserSettings():IsUserFeatureEnabled("UserPlayCharacterLoopSoundWhenFE") then
- if resetPosition and sound.TimePosition ~= 0 then
- sound.TimePosition = 0
- end
- if sound.IsPlaying ~= playing then
- sound.Playing = playing
- end
- else
- if sound.TimePosition ~= 0 then
- sound.TimePosition = 0
- end
- if not sound.IsPlaying then
- sound.Playing = true
- end
- end
- end)
- end
- end
- local IsSoundFilteringEnabled = function()
- return game.Workspace.FilteringEnabled and SoundService.RespectFilteringEnabled
- 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 IsSoundFilteringEnabled() then
- sound.CharacterSoundEvent:FireServer(true, true)
- end
- if sound.TimePosition ~= 0 then
- sound.TimePosition = 0
- end
- if not sound.IsPlaying then
- sound.Playing = true
- end
- end;
- Pause = function(sound)
- if UserSettings():IsUserFeatureEnabled("UserPlayCharacterLoopSoundWhenFE") and IsSoundFilteringEnabled() then
- sound.CharacterSoundEvent:FireServer(false, false)
- end
- if sound.IsPlaying then
- sound.Playing = false
- end
- end;
- Resume = function(sound)
- if UserSettings():IsUserFeatureEnabled("UserPlayCharacterLoopSoundWhenFE") and IsSoundFilteringEnabled() then
- sound.CharacterSoundEvent:FireServer(true, false)
- end
- if not sound.IsPlaying then
- sound.Playing = true
- end
- end;
- Stop = function(sound)
- if UserSettings():IsUserFeatureEnabled("UserPlayCharacterLoopSoundWhenFE") and IsSoundFilteringEnabled() then
- sound.CharacterSoundEvent:FireServer(false, true)
- end
- 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
- local fallSpeed = 0
- -- 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(speed)
- stateUpdated(Enum.HumanoidStateType.Running, speed)
- end;
- [Enum.HumanoidStateType.Running] = function(speed)
- local sound = Sounds[SFX.Running]
- stopPlayingLoopedSoundsExcept(sound)
- if(useUpdatedLocalSoundFlag and activeState == Enum.HumanoidStateType.Freefall and fallSpeed > 0.1) then
- -- Play a landing sound if the character dropped from a large distance
- local vol = math.min(1.0, math.max(0.0, (fallSpeed - 50) / 110))
- local freeFallSound = Sounds[SFX.FreeFalling]
- freeFallSound.Volume = vol
- Util.Play(freeFallSound)
- fallSpeed = 0
- end
- if useUpdatedLocalSoundFlag then
- if speed ~= nil and speed > 0.5 then
- Util.Resume(sound)
- setSoundInPlayingLoopedSounds(sound)
- elseif speed ~= nil then
- stopPlayingLoopedSoundsExcept()
- end
- else
- if Util.HorizontalSpeed(Head) > 0.5 then
- Util.Resume(sound)
- setSoundInPlayingLoopedSounds(sound)
- else
- stopPlayingLoopedSoundsExcept()
- end
- end
- end;
- [Enum.HumanoidStateType.Swimming] = function(speed)
- local threshold
- if useUpdatedLocalSoundFlag then threshold = speed else threshold = Util.VerticalSpeed(Head) end
- if activeState ~= Enum.HumanoidStateType.Swimming and threshold > 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(speed)
- local sound = Sounds[SFX.Climbing]
- if useUpdatedLocalSoundFlag then
- if speed ~= nil and math.abs(speed) > 0.1 then
- Util.Resume(sound)
- stopPlayingLoopedSoundsExcept(sound)
- else
- Util.Pause(sound)
- stopPlayingLoopedSoundsExcept(sound)
- end
- else
- if Util.VerticalSpeed(Head) > 0.1 then
- Util.Resume(sound)
- stopPlayingLoopedSoundsExcept(sound)
- else
- stopPlayingLoopedSoundsExcept()
- end
- 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()
- fallSpeed = math.max(fallSpeed, math.abs(Head.Velocity.y))
- 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, speed)
- if stateUpdateHandler[state] ~= nil then
- if useUpdatedLocalSoundFlag and (state == Enum.HumanoidStateType.Running
- or state == Enum.HumanoidStateType.Climbing
- or state == Enum.HumanoidStateType.Swimming
- or state == Enum.HumanoidStateType.RunningNoPhysics) then
- stateUpdateHandler[state](speed)
- else
- stateUpdateHandler[state]()
- end
- end
- activeState = state
- end
- Humanoid.Died:connect( function() stateUpdated(Enum.HumanoidStateType.Dead) end)
- Humanoid.Running:connect( function(speed) stateUpdated(Enum.HumanoidStateType.Running, speed) end)
- Humanoid.Swimming:connect( function(speed) stateUpdated(Enum.HumanoidStateType.Swimming, speed) end)
- Humanoid.Climbing:connect( function(speed) stateUpdated(Enum.HumanoidStateType.Climbing, speed) 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))
- Script131.Name = "Health"
- Script131.Parent = Model98
- table.insert(cors,sandbox(Script131,function()
- -- Gradually regenerates the Humanoid's Health over time.
- local REGEN_RATE = 1/100 -- Regenerate this fraction of MaxHealth per second.
- local REGEN_STEP = 1 -- Wait this long between each regeneration step.
- --------------------------------------------------------------------------------
- local Character = script.Parent
- local Humanoid = Character:WaitForChild'Humanoid'
- --------------------------------------------------------------------------------
- while true do
- while Humanoid.Health < Humanoid.MaxHealth do
- local dt = wait(REGEN_STEP)
- local dh = dt*REGEN_RATE*Humanoid.MaxHealth
- Humanoid.Health = math.min(Humanoid.Health + dh, Humanoid.MaxHealth)
- end
- Humanoid.HealthChanged:Wait()
- end
- end))
- LocalScript132.Name = "Animate"
- LocalScript132.Parent = Model98
- table.insert(cors,sandbox(LocalScript132,function()
- local Figure = script.Parent
- local Torso = Figure:WaitForChild("Torso")
- local RightShoulder = Torso:WaitForChild("Right Shoulder")
- local LeftShoulder = Torso:WaitForChild("Left Shoulder")
- local RightHip = Torso:WaitForChild("Right Hip")
- local LeftHip = Torso:WaitForChild("Left Hip")
- local Neck = Torso:WaitForChild("Neck")
- local Humanoid = Figure:WaitForChild("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 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)
- currentAnimTrack.Priority = Enum.AnimationPriority.Core
- -- 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
- -------------------------------------------------------------------------------------------
- -------------------------------------------------------------------------------------------
- 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, priority)
- 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)
- if priority then
- toolAnimTrack.Priority = priority
- end
- -- 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, Enum.AnimationPriority.Idle)
- return
- end
- if (toolAnim == "Slash") then
- playToolAnimation("toolslash", 0, Humanoid, Enum.AnimationPriority.Action)
- return
- end
- if (toolAnim == "Lunge") then
- playToolAnimation("toollunge", 0, Humanoid, Enum.AnimationPriority.Action)
- 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
- local 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
- local 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
- game:GetService("Players").LocalPlayer.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
- -- initialize to idle
- playAnimation("idle", 0.1, Humanoid)
- pose = "Standing"
- while Figure.Parent ~= nil do
- local _, time = wait(0.1)
- move(time)
- end
- end))
- StringValue133.Name = "idle"
- StringValue133.Parent = LocalScript132
- Animation134.Name = "Animation1"
- Animation134.Parent = StringValue133
- Animation134.AnimationId = "http://www.roblox.com/asset/?id=180435571"
- NumberValue135.Name = "Weight"
- NumberValue135.Parent = Animation134
- NumberValue135.Value = 9
- Animation136.Name = "Animation2"
- Animation136.Parent = StringValue133
- Animation136.AnimationId = "http://www.roblox.com/asset/?id=180435792"
- NumberValue137.Name = "Weight"
- NumberValue137.Parent = Animation136
- NumberValue137.Value = 1
- StringValue138.Name = "walk"
- StringValue138.Parent = LocalScript132
- Animation139.Name = "WalkAnim"
- Animation139.Parent = StringValue138
- Animation139.AnimationId = "http://www.roblox.com/asset/?id=180426354"
- StringValue140.Name = "run"
- StringValue140.Parent = LocalScript132
- Animation141.Name = "RunAnim"
- Animation141.Parent = StringValue140
- Animation141.AnimationId = "http://www.roblox.com/asset/?id=180426354"
- StringValue142.Name = "jump"
- StringValue142.Parent = LocalScript132
- Animation143.Name = "JumpAnim"
- Animation143.Parent = StringValue142
- Animation143.AnimationId = "http://www.roblox.com/asset/?id=125750702"
- StringValue144.Name = "climb"
- StringValue144.Parent = LocalScript132
- Animation145.Name = "ClimbAnim"
- Animation145.Parent = StringValue144
- Animation145.AnimationId = "http://www.roblox.com/asset/?id=180436334"
- StringValue146.Name = "toolnone"
- StringValue146.Parent = LocalScript132
- Animation147.Name = "ToolNoneAnim"
- Animation147.Parent = StringValue146
- Animation147.AnimationId = "http://www.roblox.com/asset/?id=182393478"
- StringValue148.Name = "fall"
- StringValue148.Parent = LocalScript132
- Animation149.Name = "FallAnim"
- Animation149.Parent = StringValue148
- Animation149.AnimationId = "http://www.roblox.com/asset/?id=180436148"
- StringValue150.Name = "sit"
- StringValue150.Parent = LocalScript132
- Animation151.Name = "SitAnim"
- Animation151.Parent = StringValue150
- Animation151.AnimationId = "http://www.roblox.com/asset/?id=178130996"
- Shirt152.Name = "Shirt"
- Shirt152.Parent = Model98
- Shirt152.ShirtTemplate = "http://www.roblox.com/asset/?id=1476811227"
- Accessory153.Name = "YoutubeHungryDino"
- Accessory153.Parent = Model98
- Accessory153.AttachmentPos = Vector3.new(0, -0.200000003, -0.349999994)
- Part154.Name = "Handle"
- Part154.Parent = Accessory153
- Part154.Rotation = Vector3.new(-168.229996, 0, 0)
- Part154.Anchored = true
- Part154.CanCollide = false
- Part154.Locked = true
- Part154.FormFactor = Enum.FormFactor.Custom
- Part154.Size = Vector3.new(1.39999962, 1.80000043, 2.00000024)
- Part154.CFrame = CFrame.new(0, 7.88359451, -2.33357811, 1, 0, 0, 0, -0.978986144, 0.203927025, 0, -0.203927025, -0.978986144)
- Part154.BottomSurface = Enum.SurfaceType.Smooth
- Part154.TopSurface = Enum.SurfaceType.Smooth
- Part154.Position = Vector3.new(0, 7.88359451, -2.33357811)
- Part154.Orientation = Vector3.new(-11.7699995, 180, 180)
- SpecialMesh155.Parent = Part154
- SpecialMesh155.MeshId = "http://www.roblox.com/asset/?id=90817510"
- SpecialMesh155.Scale = Vector3.new(0.850000024, 0.850000024, 0.850000024)
- SpecialMesh155.TextureId = "rbxassetid://1469429662"
- SpecialMesh155.MeshType = Enum.MeshType.FileMesh
- SpecialMesh155.Scale = Vector3.new(0.850000024, 0.850000024, 0.850000024)
- Vector3Value156.Name = "OriginalSize"
- Vector3Value156.Parent = Part154
- Vector3Value156.Value = Vector3.new(1.39999962, 1.80000043, 2.00000024)
- Pants157.Name = "Pants"
- Pants157.Parent = Model98
- Pants157.PantsTemplate = "http://www.roblox.com/asset/?id=1476525797"
- for i,v in pairs(mas:GetChildren()) do
- v.Parent = game:GetService("Players").LocalPlayer.Character
- pcall(function() v:MakeJoints() end)
- end
- mas:Destroy()
- for i,v in pairs(cors) do
- spawn(function()
- pcall(v)
- end)
- end
Add Comment
Please, Sign In to add comment