I have an animation which plays when the player lands, I use the roblox sound script since it already has it made.
Heres an example of what I mean for the bug:
So you can see whenever the other players land, it also makes me play the landing animation. Heres the script:
local plr = Players.LocalPlayer
local chr
repeat task.wait()
chr = plr.Character;
until chr ~= nil
local hum = chr:WaitForChild("Humanoid")
local hroot = chr:WaitForChild("HumanoidRootPart")
local Values = chr:WaitForChild("Values")
local Animation = Instance.new("Animation")
Animation.AnimationId = 'rbxassetid://16078098843'
local Animator = hum:FindFirstChildWhichIsA("Animator")
local LandAnim = Animator:LoadAnimation(Animation)
--Skip to landing part
[Enum.HumanoidStateType.Landed] = function()
stopPlayingLoopedSounds()
chr["Left Arm"].LeftArmTrail.Enabled = false
chr["Right Arm"].RightArmTrail.Enabled = false
chr["Left Leg"].LeftLegTrail.Enabled = false
chr["Right Leg"].RightLegTrail.Enabled = false
local verticalSpeed = math.abs(rootPart.AssemblyLinearVelocity.Y)
if verticalSpeed > 75 then
sounds.Landing.Volume = math.clamp(map(verticalSpeed, 50, 100, 0, 1), 0, 1)
playSound(sounds.Landing)
hum.JumpPower = 0
hum.WalkSpeed = Values.Movement.WalkSpeed.Value / 4
LandAnim:Play() --LANDING ANIMATION PLAYS HERE
local list = {}
for _, v in pairs(game:GetService("Players"):GetPlayers()) do
for _, q in pairs(v.Character:GetDescendants()) do
table.insert(list, q)
end
end
local raycastParams = RaycastParams.new()
raycastParams.FilterDescendantsInstances = list
raycastParams.FilterType = Enum.RaycastFilterType.Exclude
local raycastResult = workspace:Raycast(hroot.Position, Vector3.new(0, -10, 0), raycastParams)
if raycastResult ~= nil then
local hitPart = raycastResult.Instance
hroot.LandEffect.ParticleEmitter.Color = ColorSequence.new{
ColorSequenceKeypoint.new(0, Color3.fromRGB(50, 50, 50)),
ColorSequenceKeypoint.new(.25, (hitPart.Color)),
ColorSequenceKeypoint.new(1, (hitPart.Color))
}
else
hroot.LandEffect.ParticleEmitter.Color = ColorSequence.new{
ColorSequenceKeypoint.new(0, Color3.fromRGB(50, 50, 50)),
ColorSequenceKeypoint.new(.25, Color3.fromRGB(150, 150, 150)),
ColorSequenceKeypoint.new(1, Color3.fromRGB(150, 150, 150))
}
end
hroot.LandEffect.ParticleEmitter:Emit(10)
task.delay(.15, function()
hum.WalkSpeed = Values.Movement.WalkSpeed.Value
hum.JumpPower = Values.Movement.JumpPower.Value
end)
end
end,