Help with warn message to specific player

Hello, I need to add a warning message in my code and I have a screengui, frame and textlabel already created and with their respective messages, I would like to be able to show these messages to specific players following the following form of writing in the chat:

message β†’ message == '.warn ' .. Player2.Name

What I need is enable and disable the playerGUI of player2 in the code, how can I do that? :frowning:

I’m not really sure how to enable the screengui of a specific player, is this possible and how can I do it?

image

script:

-- warn player message
		if Player.TeamColor == BrickColor.new("Lapis") then
			for i,Player2 in pairs(Players:GetPlayers()) do
				if message == '.warn ' .. Player2.Name then
					print("The player name is ..." .. Player2.Name)
					print("The administrator has given you a warning")
					-- code to warning here:
					
				end
			end
		end

GUI:

image

To edit a players Gui’s with a script you have to do

player.PlayerGui.Frame.TextLabel.Text = "Whatever you want to put here"

What I need is enable and disable the playerGUI of player2 in the code, how can I do that? :frowning:

Its simple, make like this

if Player.TeamColor == BrickColor.new("Lapis") then
 		for i,Player2 in pairs(Players:GetPlayers()) do
			if message == '.warn ' .. Player2.Name then
				print("The player name is ..." .. Player2.Name)
				print("The administrator has given you a warning")
				-- code to warning here:
				Player2.PlayerGui.Warning.Enabled = true
                Player2.PlayerGui.Warning.Frame.TextLabel = "The warning here"
                wait(1) -- time until disable
                Player2.PlayerGui.Warning.Enabled = false
			end
		end
	end
1 Like

It only stays true, but does not go false (the playerGUI) :frowning:

and how could i do that (reason) in the code? β†’ .warn [player] [reason]

Apologies for this :frowning:

idk how to make the reason, im sorry

1 Like

It’s okay, there’s problem, anyway, thank you very much for your effort! :smiley:

What is the Player variable equal to?