Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Making a textlabel change for everyone is the game?

So am making a minigame and I want the text to change for everyone but its not working?

This is the local script:

local client = game:GetService("Players").LocalPlayer
local RepStore = game:GetService("ReplicatedStorage")
local remote = RepStore.Remote -- LOCATING THE REMOTE

while true do

remote.OnClientEvent:Connect(function()
    local pgui = client.PlayerGui
    pgui:WaitForChild("MainText").TextLabel.Text = "Test" --Changing the textlabel

remote.OnClientEvent:Connect(function()
    local pgui = client.PlayerGui
    pgui:WaitForChild("MainText").TextLabel.Text = "TestAgain" --Changing the textlabel
end)
end)
wait(4)
end

this is the script:

local RepStore = game:GetService("ReplicatedStorage")
local remote = RepStore.Remote

wait(2)
remote:FireAllClients() --Firing to the clients

1 answer

✓ Accepted answer
local client = game:GetService("Players").LocalPlayer
local RepStore = game:GetService("ReplicatedStorage")
local remote = RepStore.Remote -- LOCATING THE REMOTE

remote.OnClientEvent:Connect(function()
    local pgui = client.PlayerGui
    pgui:WaitForChild("MainText").TextLabel.Text = "Test" --Changing the textlabel
end)

This should do the trick. You had a useless while loop and two attached functions for the same event.

5 comments

0

Didint work?

0

Was the text initially "Test"? If not, try putting a print in the remote event, see if it actually goes trough.

0

It did print but it doesnt show "Test" in the gui?

0

Nevermind I got it working thank you!

0

You're welcome!

This discussion is preserved as it was. New answers, comments, and votes are closed.