I am writing a script so that when a specified player chats a message then the GUI window appears. Below is the script I have been using, however when I run the script I get no output. I have tried debugging and found nothing wrong.
local clearance = { "EmperorD" }
local start = ":startapps"
local stop = ":stopapps"
local function checkClearance(name)
for i = 1,#clearance do
if (string.upper(name) == string.upper(clearance[i])) then return true end
end
return false
end
local function onMessaged(msg, recipient, speaker)
local source = string.lower(speaker.Name)
if msg == start or msg == stop then
if (checkClearance(source)) then
if msg == start then
script.Parent.Visible = true
end
if msg == stop then
script.Parent.Visible = false
end
end
end
end
function onPlayerJoin(newPlayer)
newPlayer.Chatted:connect(function(msg, recipient) onMessaged(msg, recipient, newPlayer) end)
end
game.Players.ChildAdded:connect(onPlayerJoin)

1 comment
Thanks for the help!