Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Making a textlabel change for everyone is the game?

Asked by 5 years ago

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

Log in to vote
0
Answered by 5 years ago
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.

0
Didint work? Nosh4309 8 — 5y
0
Was the text initially "Test"? If not, try putting a print in the remote event, see if it actually goes trough. Golubian 37 — 5y
0
It did print but it doesnt show "Test" in the gui? Nosh4309 8 — 5y
0
Nevermind I got it working thank you! Nosh4309 8 — 5y
0
You're welcome! Golubian 37 — 5y
Ad

Answer this question