I think this is because of the delay between the moment the player joins and until ROBLOX makes them a Speaker.
Instead try binding your function to SpeakerAdded in ChatService this way whenever your function runs, the speaker will always be there
One tip for you though is to use assert(), it's a good debugging tool and really easy to use. Basically if the condition is false it prints what you told it to and breaks, so like this:
assert(true,"This will never print because the condition is always true")
assert(false,"This will always print because the condition is always false")
print("This will not print because when assert if false, it breaks")
plr = game.Players:FindFirstChild("someReallyWeirdName")
assert(plr,"If this prints then the player doesn't exist and if the code runs it will error")
1 comment
Put your script in this thread in code tags, please.