I’m trying to use SetStateEnabled to prevent the FallingDown state from ever occurring on my player’s charatcer. However, I still get cases where it can happen
-- Done on server*
player.CharacterAdded:Connect(function(character)
character.Humanoid:SetStateEnabled(Enum.HumanoidStateType.FallingDown, false)
end)
As this user suggests, the client has network ownership over the local player’s character, so this needs to be handled by the client.
local Players = game:GetService("Players")
local Player = Players.LocalPlayer
local function OnCharacterAdded(Character)
local Humanoid = Character:WaitForChild("Humanoid")
local function OnHumanoidStateChanged(OldState, NewState)
print(Humanoid:GetStateEnabled(Enum.HumanoidStateType.FallingDown)) --Always false.
end
Humanoid.StateChanged:Connect(OnHumanoidStateChanged)
Humanoid:SetStateEnabled(Enum.HumanoidStateType.FallingDown, false)
end
Player.CharacterAdded:Connect(OnCharacterAdded)