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

Problem With Chatted Event?

Asked by
MrFlimsy 345 Moderation Voter
10 years ago

I'm trying to make it so that if someone in my list of admins types "/e msg (message)", it will create a new Message object in Workspace, display the message for 2.5 seconds, then destroy it. The problem is, when I try to use it, nothing happens and there is no output.

Here is the code:

01local admins = {
02    "MrFlimsy"
03    "Interactivity"
04    "NotAshley"
05}
06 
07function isAdmin(player)
08    for _,v in pairs(admins) do
09        if v == player then
10            return true
11        end
12    end
13end
14 
15game.Players.PlayerAdded:connect(function(plr)
View all 29 lines...

1 answer

Log in to vote
6
Answered by
Sublimus 992 Moderation Voter
10 years ago

You have to separate values in a table:

1local admins = { --Note the commas
2    "MrFlimsy",
3    "Interactivity",
4    "NotAshley"
5}

Also, you are trying to compare an object to a string, it should be:

1if isAdmin(plr.Name) then --Since plr is an object you have to get it's name since it's name is a string and that is what you are trying to compare to in the function.
0
Thanks. I don't know how I overlooked that. +1 to you! MrFlimsy 345 — 10y
Ad

Answer this question