Client Sided Script not running. It’s meant to run after that certain amount of studs
-- Services
local RS = game:GetService("ReplicatedStorage")
-- Folders
local RSStorage = RS.Storage
local RSEvents = RSStorage.RemoteEvents
-- Character/Humaniod
local Players = game:GetService("Players")
local Player = Players.LocalPlayer
local char = Player.Character
local hum = char:WaitForChild("Humanoid")
local HRP = hum:WaitForChild("HumanoidRootPart")
-- Values
local Height
local RollHeight = 20
local FallDamageHeight = 35
hum.StateChanged:Connect(function(OldState, NewState)
if NewState == Enum.HumanoidStateType.Landed then
local Height = -HRP.Velocity.Y
if Height >= 10 and Height <= 100 then
RSEvents.MovementEvents.Roll:FireServer(char)
end
end
end)
local LandAnim = script:FindFirstChild("Land")
local playAnim = hum:LoadAnimation(LandAnim)
hum.StateChanged:Connect(function(OldState,NewState)
if NewState == Enum.HumanoidStateType.Landed then
local Height = -HRP.Velocity.Y
print ("Landed")
if Height >= RollHeight and Height <= 10 then
playAnim:Play()
wait(1)
playAnim:Stop()
end
end
end)
hum.StateChanged:Connect(function(OldState,NewState)
if NewState == Enum.HumanoidStateType.Landed then
local Height = -HRP.Velocity.Y
print ("Lande")
if Height >= FallDamageHeight then
RSEvents.MovementEvents.FallDamage:FireServer(char)
end
end
end)
-- Services
local RS = game:GetService("ReplicatedStorage")
-- Folders
local RSStorage = RS.Storage
local RSEvents = RSStorage.RemoteEvents
-- Character/Humanoid
local Players = game:GetService("Players")
local Player = Players.LocalPlayer
local char = Player.Character or Player.CharacterAdded:Wait()
local hum = char:WaitForChild("Humanoid")
local HRP = char:WaitForChild("HumanoidRootPart")
-- Values
local RollHeight = 20
local FallDamageHeight = 35
hum.StateChanged:Connect(function(_, NewState)
if NewState == Enum.HumanoidStateType.Landed then
local Height = -HRP.Velocity.Y
if Height >= RollHeight and Height < FallDamageHeight then
RSEvents.MovementEvents.Roll:FireServer(char)
local LandAnim = script:FindFirstChild("Land")
if LandAnim then
local playAnim = hum:LoadAnimation(LandAnim)
playAnim:Play()
task.wait(1)
playAnim:Stop()
end
elseif Height >= FallDamageHeight then
RSEvents.MovementEvents.FallDamage:FireServer(char)
end
end
end)
Player.CharacterAdded:Wait() as a fail safe for timing.
Combined all StateChanged connections into a single connection.
Animation should only play when a valid Land animation is found.
-- Services
local RS = game:GetService("ReplicatedStorage")
-- Folders
local RSStorage = RS.Storage
local RSEvents = RSStorage.RemoteEvents
-- Character/Humanoid
local Players = game:GetService("Players")
local Player = Players.LocalPlayer
local char = Player.Character or Player.CharacterAdded:Wait()
local hum = char:WaitForChild("Humanoid")
local HRP = char:WaitForChild("HumanoidRootPart")
-- Values
local RollHeight = 20
local FallDamageHeight = 35
-- Load Animation
local LandAnim = script:FindFirstChild("Land")
local playAnim = LandAnim and hum:LoadAnimation(LandAnim)
-- Handle StateChanged
hum.StateChanged:Connect(function(_, NewState)
if NewState == Enum.HumanoidStateType.Landed then
local Height = -HRP.Velocity.Y
print("Landed with Height: " .. Height)
if Height >= RollHeight and Height <= 10 then
if playAnim then
playAnim:Play()
wait(1)
playAnim:Stop()
end
end
if Height >= FallDamageHeight then
RSEvents.MovementEvents.FallDamage:FireServer(char)
end
end
end)