Need help with a scripting issue, can't seem to figure it out

Hey there!
I’m Shark, and I need a little help.
So, I’m not the greatest at scripting, but I can’t seem to figure out how to make this work.
So, basically, if you type in chat, “!host” a GUI will open on everyone’s screen, that I have figured out, although, the GUI is supposed to say this : "Greetings and welcome to your in-game Moderator training session. I am your Host, [ username ] "
The part where it say’s "[ Username ] " I need the person who sent the message, their username to appear there.
With my script, everyone’s name appears.
Here’s the script :

script.Parent.Text = "Greetings and welcome to your in-game Moderator training session. I am your Host, ".. game.Players.LocalPlayer.Name

If someone could help me, it would be appreciated. And sorry if I’ve done something wrong.
Thanks.

if you are using a remote event add an argument that tells which player said !host and use that instead of the local player. It would also help if you could link more of the script

Ah, okay. That’s the script, only problem is, I’m not good with RemoveEvents…

to communicate between client and server I think you will need remote events

how are you detecting when a player says “!host” and how are you sending that to the clients

Okay, so I have a RemoveEvent already called “HostText”, this is for the GUI to open.
I have a Script in Server Script Service, this one :

local GroupId = 8266373
local MinimumRank = 252
local Event = game.ReplicatedStorage:WaitForChild('HostText')

game.Players.PlayerAdded:Connect(function(Player)
	Player.Chatted:Connect(function(Message)
		if Player:GetRankInGroup(GroupId) >= MinimumRank then
			if Message == "!host" then
				Event:FireAllClients('show')
			elseif Message == "!stophostmessage" then
				Event:FireAllClients('hide')
			end
		end
	end)
end)

and then, I have another script in the GUI :

local Event = game.ReplicatedStorage:WaitForChild('HostText')

Event.OnClientEvent:Connect(function(arg)
	if arg == 'show' then
		script.Parent.HostText.Visible = true
		wait(5.3)
		script.Parent.HostText.Visible = false
	elseif arg == 'hide' then
		script.Parent.Enabled = false
	end
end)

That works, the only problem is, when I do !host the message shows, but when it goes to the username part, it doesn’t show the person who sent the message’s username, it show’s your username.

Ok so you can add who sent the message when you fire all clients

local GroupId = 8266373
local MinimumRank = 252
local Event = game.ReplicatedStorage:WaitForChild('HostText')

game.Players.PlayerAdded:Connect(function(Player)
	Player.Chatted:Connect(function(Message)
		if Player:GetRankInGroup(GroupId) >= MinimumRank then
			if Message == "!host" then
				Event:FireAllClients('show', Player)
			elseif Message == "!stophostmessage" then
				Event:FireAllClients('hide')
			end
		end
	end)
end)

In the other script you could do

local Event = game.ReplicatedStorage:WaitForChild('HostText')
local MainText = "Greetings and welcome to your in-game Moderator training session. I am your Host,  "

Event.OnClientEvent:Connect(function(arg, arg2)
	if arg == 'show' then
            script.Parent.HostText.Text = MainText..arg2.Name
		script.Parent.HostText.Visible = true
		wait(5.3)
		script.Parent.HostText.Visible = false
	elseif arg == 'hide' then
		script.Parent.Enabled = false
	end
end)

Do not use FireAllClients, you only want to use this for one player. Instead, do this: Event:FireClient(playerToFire,otherParameters)

Alrighty, let me try that. Thanks for your help.

Not working. Unfortunately. Now what?

Like this?

local GroupId = 8266373
local MinimumRank = 252
local Event = game.ReplicatedStorage:WaitForChild('HostText')

game.Players.PlayerAdded:Connect(function(Player)
	Player.Chatted:Connect(function(Message)
		if Player:GetRankInGroup(GroupId) >= MinimumRank then
			if Message == "!host" then
				Event:FireClient(playerToFire,otherParameters(show', Player)
			elseif Message == "!stophostmessage" then
				Event:FireClient(playerToFire,otherParameters('hide')
			end
		end
	end)
end)

it comes as an error.

No, like this:

Event:FireClient(Player,”show”)

Put this on the only line, this should replace the old FireClient thing

And on the hide line:

Event:FireClient(Player,”hide”)

That wont work as intended for 2 reasons
1: You forgot to close the quotes on line 8
2: You want everyone to see that so you would use fire all clients

They misunderstood my pseudo code, they copied and pasted it literally. I gave them a corrected script.

Nothing seems to working. Thanks for the help though.

Did you try the script I gave?

local GroupId = 8266373
local MinimumRank = 252
local Event = game.ReplicatedStorage:WaitForChild('HostText')

game.Players.PlayerAdded:Connect(function(Player)
	Player.Chatted:Connect(function(Message)
		if Player:GetRankInGroup(GroupId) >= MinimumRank then
			if Message == "!host" then
                                print(“Sending show message”)
				Event:FireAllClients(”show”,Player)
			elseif Message == "!stophostmessage" then

                                print(“Hiding show message”)

				Event:FireAllClients(”hide”)
			else print(“Invalid message”) end
		end
	end)
end)

In the other script you do

local Event = game.ReplicatedStorage:WaitForChild('HostText')
local MainText = "Greetings and welcome to your in-game Moderator training session. I am your Host,  "

Event.OnClientEvent:Connect(function(arg, host)
    print(“Got event”)
	if arg == 'show' then
           print(“Showing”)
            script.Parent.HostText.Text = MainText..host.Name
		script.Parent.HostText.Visible = true
		wait(5.3)
		script.Parent.HostText.Visible = false
	elseif arg == 'hide' then
                print(“Hiding”)
		script.Parent.Enabled = false
	end
end)

Revised script

They want to fire it on every player

Revised the script again, I missed that in OP

Alright, lemme try it again and see if it works