Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why does it give me this error message?

you see, I've been practicing my scripting and I got this error message that I don't understand. here is my code:

local Listofnames = "TroytheDestroyer, DadatheDestroyer, "
local playeradded = game.Players.PlayerAdded
if playeradded == listofnames then -- global listofnames unknown
Print game.Players.LocalPlayer..'is verified.' -- I want it to put the player's name that joined in the output.
end
if playeradded ~= listofnames then -- global listofnames unknown
Player:Kick() -- global Player unknown
Print game.Players.LocalPlayer..'has been kicked due to insufficent privilages.'
end -- is that what i do to make the kicked player's name appear on the output?
-- to all of you who saw this script before, I just want to test my scripting. so this is my first script im going to make.



























































































thanks for reading.

1 answer

✓ Accepted answer

When comparing objects, use the double equals sign ==

if playeradded == listofnames then

4 comments

0

Thanks merely, but I put that and it said another error message: "Expected '=', got 'game'". what now?

0

You generally need to use parentheses when calling a method. print(game.Players.LocalPlayer..'is verified.') instead of Print game.Players.LocalPlayer..'is verified.'

0

Thanks!

0

Wait, now it says basically that listofnames and Player are unknown. I'm a little confused.

This discussion is preserved as it was. New answers, comments, and votes are closed.