Group Chat Commands

Hello! So I want to make a chat command that will open a Gui if the player meets the group requirements and uses the command.

Heres the script:

local GroupId = 11941815
local MinimumRankToUseCommand = 15

game.Players.PlayerAdded:Connect(function(Player)
Player.Chatted:Connect(function(Message)
if Message == “/Commands” and Player:GetRankInGroup(GroupId) >= MinimumRankToUseCommand then
game.StarterGui.NextTechADMIN.VerificationPanel.Enabled = true
end
end)
end)

1 Like

Just put the GUI inside StarterGui, then in your script (server side) do this.

Player.PlayerGui.TheCommandGui.Enabled = true

Make sure to set TheCommandGui’s Enabled property to false.
You could also just clone the GUI into playergui.

You can’t change properties of ScreenGuis throught server side script. I recommend first clone your gui to all players and later make it visible for given player.

Something like this:

local GroupId = 11941815
local MinimumRankToUseCommand = 15

local ScreenGui = game.ReplicatedStorage.ScreenGui -- Your screen/object gui 

game.Players.PlayerAdded:Connect(function(Player)
	
	local clone = ScreenGui:Clone()
	clone.Enabled = false
	clone.Parent = Player:WaitForChild("PlayerGui")
	
	Player.Chatted:Connect(function(Message)
		if Message == "/Commands" and Player:GetRankInGroup(GroupId) >= MinimumRankToUseCommand then
			clone.Enabled = true
		end
	end)
end)
3 Likes

Pretty sure you can, I tried on this demo .

function PlayerAdded(Player)
	Player.Chatted:Connect(function(Message)
		if Message:lower() == "!cmds" then
			Player:WaitForChild("PlayerGui").ScreenGui.Enabled = true
		end
	end)
end
for _,v in ipairs(game.Players:GetChildren()) do
	coroutine.wrap(PlayerAdded)(v)
end
game.Players.PlayerAdded:Connect(PlayerAdded)

Edit: Weird, it worked when I tried it but now its not.

1 Like

Roblox is breaking so often LOL

1 Like