local Landing = Instance.new(“Animation”)
Landing.AnimationId = “rbxassetid://13125264164”
local Landed = game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)
local Humanoid = char.Humanoid
local fallingTime = -1
Humanoid.StateChanged:Connect(function(PreviousState, NewState)
if NewState == Enum.HumanoidStateType.Freefall then
if Humanoid:GetState() == Enum.HumanoidStateType.Freefall then
fallingTime = tick()
end
elseif NewState == Enum.HumanoidStateType.Landed then
if (tick() - fallingTime > 2) then
local animTrack = Humanoid:LoadAnimation(Landing)
animTrack:Play()
local explosion = Instance.new(“Explosion”)
explosion.Position = char.UpperTorso.Position
explosion.BlastRadius = 0
explosion.Parent = game.Workspaceend end end)
end)
end)
any help will be appreciated
I have placed this script in the startercharacterscript it is supposed to detect if the player is falling for 2 seconds and if the player lands it will play
Try this (in startercharacterscripts)
local char=script.Parent
local Humanoid = char:WaitForChild("Humanoid")
local Landing = Instance.new("Animation")
Landing.AnimationId = "rbxassetid://13125264164"
local animTrack = Humanoid:LoadAnimation(Landing)
local fallingTime = -1
Humanoid.StateChanged:Connect(function(PreviousState, NewState)
if NewState == Enum.HumanoidStateType.Freefall then
if Humanoid:GetState() == Enum.HumanoidStateType.Freefall then fallingTime = tick() end
elseif NewState == Enum.HumanoidStateType.Landed then
if (tick() - fallingTime > 2) then
animTrack:Play()
local explosion = Instance.new("Explosion")
explosion.Position = char.UpperTorso.Position
explosion.BlastRadius = 0
explosion.Parent = game.Workspace
end
end
end)
Because it’s in starter character scripts there is no need to connect to PlayerAdded or CharacterAdded
1 Like
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.