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

Am I doing this wrong?

Asked by 9 years ago
01local group = {
02    ["jameswowsmile"] = true;
03    ["leslielol1234"] = true;
04}
05 
06game.Players.PlayerAdded:connect(function(player)
07    if group[player.Name] then
08        player.Chatted:connect(function(msg)
09            --chatted code
10        end)
11    end
12end)
13 
14 
15door = script.Parent --this is the door
View all 36 lines...

This is supposed to give two players (Jameswowsmile and Leslielol1234) permission to say a command that would make a floor disappear when you say "FloorClose". I tested this and it didn't work. What did I do wrong?

1 answer

Log in to vote
0
Answered by 9 years ago

Problems

  1. You need to add the chatted door thing inside the chatted thing
  2. You are comparing a lowercase to an uppercase(lowercase all the letters in FloorClose)

Final Product

01local group = {
02    ["jameswowsmile"] = true;
03    ["leslielol1234"] = true;
04}
05 
06game.Players.PlayerAdded:connect(function(player)
07    if group[player.Name] then
08        player.Chatted:connect(function(msg)
09            door = script.Parent
10        if msg:lower() == "floorclose" then --LowerCased "FloorClosed"
11            door.CanCollide = false
12            door.Transparency = 1
13        end
14        end)
15    end
16end)


Hope it helps!

0
Thank you! It works! However, on the 9th line, you forgot a local. Works after you put it on! BringMeTacos 20 — 9y
Ad

Answer this question