Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why does it give me this error message?

Asked by 10 years ago

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

Log in to vote
0
Answered by
Merely 2122 Moderation Voter Community Moderator
10 years ago

When comparing objects, use the double equals sign ==

if playeradded == listofnames then
0
Thanks merely, but I put that and it said another error message: "Expected '=', got 'game'". what now? TroytheDestroyer 75 — 10y
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.' Merely 2122 — 10y
0
Thanks! TroytheDestroyer 75 — 10y
0
Wait, now it says basically that listofnames and Player are unknown. I'm a little confused. TroytheDestroyer 75 — 10y
Ad

Answer this question