This is what I want to do
Server script:
local text
text = "Map has Loaded. Teleporting Players."
game.ReplicatedStorage.ChangeGui:FireAllClients(text) --//gui message
Local Script:
game.ReplicatedStorage.ChangeGui.OnClientEvent:Connect(function(plr, text)
script.Parent.MainText.Text = text
end)
SOTR654
(SOTR654)
July 13, 2021, 11:36pm
#2
It must go through the server first
Local 1:
local text = "Map has Loaded. Teleporting Players."
game.ReplicatedStorage.ChangeGui:FireServer(text) --//gui message
Server:
game.ReplicatedStorage.ChangeGui.OnServerEvent:Connect(function(plr, text)
game.ReplicatedStorage.ChangeGui:FireAllClients(text)
end)
Local 2
game.ReplicatedStorage.ChangeGui.OnClientEvent:Connect(function(text)
script.Parent.MainText.Text = text
end)
sorry correction my first script is a server script sorry for the mistake
SOTR654
(SOTR654)
July 13, 2021, 11:39pm
#4
Well, OnClientEvent does not need the player as the first parameter, change this line
For this
alright I did i get the error that it thinks the “text” paramater is nil
I don’t know if this would change anything, but maybe declare your variable like so?
Local text = “Map is Loaded. Teleporting players.”
flkfv
(flkfv)
July 13, 2021, 11:58pm
#7
You don’t need a player parameter for OnClientEvent.
Be careful about what information is sent to the server. I understand this is an example but there is no filtering of the text and any player or even exploiter can fire this remote and display something bad to all the users.
it wouldnt change anything I dont think but ill try it
Found out the problem was with studio not comitting scripts
1 Like