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

Can someone help me?

Asked by 10 years ago

What it's supposed to do is pop up, when you say "MainMenu/On", for you though. Not everyone else. So what I'm saying is it will pop up for only 1 player, if they say it. Can someone do this? And make it so if you say "MainMenu/Off", it will go not visible again.

if message:lower() == "MainMenu/On" then

gui.Visible = not gui.Visible -- Sets GUI visibility to the opposite of what it was (toggle)

end
0
First issue that comes to mind is that if you make the message lowercase, it won't match the message you've set (which has uppercase letters) trogyssy 221 — 10y
0
I noticed that as well. On my script, if you want it lowered, I did that for you. If not? Remove my Line 2 and in lines 3 and 6, edit what they say.' Shawnyg 4330 — 10y

2 answers

Log in to vote
0
Answered by
Shawnyg 4330 Trusted Badge of Merit Snack Break Moderation Voter Community Moderator
10 years ago

I just edited an AFK script that I made previously. What helped me was the "How do I ban people from my place?" wiki article.

local function onChatted(msg, recipient, speaker)
    local msg = msg:lower()
    if msg == "mainmenu/on" then 
        if not speaker.PlayerGui["Name of the main menu"].Visible == true then
            speaker.PlayerGui["Name of the main menu"].Visible = true
elseif msg == "mainmenu/off" then
        if not speaker.PlayerGui["Name of the main menu"].Visible == false then
        speaker.PlayerGui["Name of the main menu"].Visible = false
            end
        end
        end
end

function onPlayerEntered(newPlayer)

    newPlayer.Chatted:connect(function(msg, recipient) onChatted(msg, recipient, newPlayer) end) 
        end


game.Players.PlayerAdded:connect(onPlayerEntered)

---------------------------
--| SHAWNYG PRODUCTIONS |--
---------------------------
Ad
Log in to vote
-2
Answered by 10 years ago

Shouldn't it be this?

if message:lower() == "MainMenu/On" then

gui.Visible = false -- Sets GUI visibility to the opposite of what it was (toggle)

end

Also, I could help you more if you included the whole script, as this does not look like a completed script.

0
Actually, your script is right, but there is no specific player. fahmisack123 385 — 10y

Answer this question