"character" variable is nil, while player.Character is model


look at this, why “character” variable is nil?
Its module script (required in local script).
Also if i add some preload it will fix

Sorry if I didnt explain problem clearly

Try local character = player.Character or player.CharacterAdded:Wait()

I suspect that the character is getting loaded in between the two statements (although they ARE awfully close together, so it’s unusual).

The tidiest fix for this issue is doing something like this:

local character = player.Character or player.CharacterAdded:Wait()

edit: dang it Nyrion, copying my code suggestion before I even send it >:(

2 Likes

Ah yes, great minds think alike

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.