Court System Announcement

So, today I was working on an “Announcement” System for a Court Roleplay. Anyways, how its supposed to work is, Judges should be able to run “!start” and the Announcement Label should change to the texts provided in the code but its not.

local startLabel = game.StarterGui.ThingySystem.ThingyLabel
local Judges = {"HonorableNolanC"}

Players.PlayerAdded:Connect(function(plr)
	if plr == Judges then
		plr.Chatted(function(message)
			if string.sub(message, 1, #"!start"):lower() == "!start" then
				startLabel.Text = "All rise for the honorable Judge," .. plr.Name
				wait(5)
				startLabel.Text = "You may be seated."
				wait(5)
				startLabel.Text = "Please be seated upon joining, the Honorable Judge" .. plr.Name .. "is presiding."
			end
		end)
	end
end)```
1 Like

Your check should be if Judges[plr.Name] then

3 Likes

Or,you could put a boolvalue inside the player.

1 Like

No, that checks if the index is true. His table doesn’t have anything assigned to it.

1 Like

Do what @DatabaseReplace said, however your code snippet should actually be this:

local Judges = {["HonorableNolanC"] = true}
...
if Judges[plr.Name] then

Likewise, you should add a debounce to prevent it being done multiple times concurrently.

2 Likes

You are not changing the GUI that’s in each client, you’re only changing the StarterGui, basically the template from where your GUIs get replicated to the client when they join.

Instead, set the variable for each client’s own GUI right after PlayerAdded.

Players.PlayerAdded:Connect(function(plr)
    local startLabel = plr.PlayerGui:WaitForChild("YourGUINameHere")
    -- This way we're targeting each player's already cloned GUI.
    -- Rest of the code goes here
end)
2 Likes

You cannot make changes to anything in the StarterGui, rather, you can make changes to the things from StarterGUI that were replicated to the PlayerGui.

1 Like

Handling gui in server is not recommended,so you can use remote for gui

1 Like

It’s not really bad to be doing it in the server at all. In fact, if you want it to appear for everyone, then why do it on the client at all?

I’d recommend you doing this on the server with a remoteEvent but whatever.

You are changing the text of a TextLabel that is in StarterGui, StarterGui is like a template of what the client should clone to it’s PlayerGui. Making changes to StaterGui will not provide realtime edits to the objects already cloned to PlayerGui. In this case you’ll need to change the property of “ThingyLabel” in PlayerGui.

Example:

game.Players.LocalPlayer.PlayerGui.Thing.Label.Text = "Test"

Next problem is you are comparing a Player instance to a Table. What you want to do is compare the name of the Player to a string.

I’m not gonna explain this one because i’m tired man, i’m going to bed.

Thank y’all so much. Sorry I didn’t reply before.