How can I fix character returning nil all the time?

So I have a script which uses plr.Character. It checks if the player has a character by if plr.Character then. But I discovered that plr.Character was returning nil all the time. This was inside a renderstepped function. I am not sure why this is happening. I did make a startercharacter into an unusual morph, but it has all the basic things.

Is this in a LocalScript or a server Script? How are you defining plr? Could you show your code so we can see what exactly is going wrong?

Without seeing any code, one thing that I tend to use that may help is when I am initializing the Character, I like to set it up with the following line:
local Character = Player.Character or Player.CharacterAdded:Wait()
This helps scripts trying to get the character when it hasn’t fully loaded in yet. Since you said this is tied to RenderStepped, this may not be the solution, but I don’t have anything else to go on.

1 Like

I fixed it myself, it was just that I defined the variable when character wasn’t there, therefore the variable was nil.