1 | local uis = game:GetService( "UserInputService" ) |
2 | local anim = Instance.new( "Animation" ) |
3 | local p = game.Players.LocalPlayer |
4 | local c = p.Character |
5 | local h = c:WaitForChild( "Humanoid" ) |
6 | if h then |
7 | print ( "H" ) |
8 | end |
it doesn't print in the output h but it says that c is a nil value how can i solve this?
1 | local c = p.Character or p.CharacterAdded:Wait() |
local c = p.Character
returned nil
because character wasnt loaded, if you add or p.CharacterAdded:Wait()
then if p.Character
returns nil
it will wait til character loads