Some help with this Command!

Hello! I need some help with a Command String.
I want it so when a Player Types in Chat “!Walkspeed” it will Enable the ScreenGUI. However, when I go In-Game, and type “!Walkspeed” nothing happens! So… I’m here for help. I think the 3rd or 2nd time today. :sweat_smile: Thanks for the help, AridOats.

Below is the Code used in a LocalScript, and is Inside the ScreenGUI:

game.Players.PlayerAdded:Connect(function(plr)
	plr.Chatted:connect(function(msg)
		if msg == "!Walkspeed" then
			script.Parent.Enabled = true
		end
	end)
end)

Is the code in a local script or a server script?

A LocalScript, inside the ScreenGUI. This is as I want it to activate a GUI.

Just make this a server script and do

game.Players.PlayerAdded:Connect(function(plr)
	plr.Chatted:connect(function(msg)
		if msg == "!Walkspeed" then
            local PlayerGui = plr:WaitForChild('PlayerGui')
			PlayerGui.YourGuiHere.Enabled = true
		end
	end)
end)

It isn’t that simple to make it happen.
The first problem is you are adding a playeradded event in a local script it won’t run because its local

–ServerScirpt

game.Players.PlayerAdded:Connect(function(plr)
local PlayerGui = plr:WaitForChild(“PlayerGui”)
plr.Chatted:connect(function(msg)
if msg == “!Walkspeed” then
PlayerGui.ScreenGui.Enabled = true
print(“Gui Enabled!”)
end
end)
end)

Put the script in server script service

Won’t this make all the Players see the GUI?

No I think because we are setting the gui enabled for the player who chatted not for everyone. If you wanted to you will need to fire a remotevent to all clients.

It’s possible that the GUI is enabled but the Visible property is set to False. Make sure that it is both Enabled and Visible.

script.Parent.Enabled = true
script.Parent.Visible = true

try a Server script to do it

game.Players.PlayerAdded:Connect(function(plr)
      plr.Chatted:Connect(function(msg)
             if msg == "!Walkspeed" then
                 plr.PlayerGui.YourGUI.Enabled = true -- Grabs only the player that said it
            end
      end)
end)