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

How do i fix a text label not changing simultaneously across all clients (all players on my game)?

Asked by 4 years ago
Edited 4 years ago

Hi, ive been scripting a story game and i have my text label changing but when i test it with my freinds, when the text label is mid changing, my freind's text label on their screen starts from the start. How do i fix this? This is my script - i've got a typing text gui so it looks like this:

local text3 = " Hello, how are you?"

for i = 1, #text3 do 
script.Parent.Text = string.sub(text3, 1 ,i)
wait()
end

this script is in a script located inside of my TextLabel.

  • the text3 variable is the variable that the text it going to type out - but when i join the game, when it starts, when another player joins, the script starts at the start instead of showing the text that is currently showing on MY screen. So let's say we had a script that would first type out this: "Hello everyone!", then it would wait 3 secs and then type "How are you", when my friend would join, the text label wouldn't show what i'm seeing (in this case: "How are you", but it would start from the start for that player and do: "Hello everyone!", then it would wait 3 secs and then type "How are you"!

I need help how i can fix this since if i keep it like this then it would be a disaster because different players would be at different points of the story instead of being on the same point of the story! Please help! If I don't find a solution then it is all over. Please help. Thankyou!

0
we can't help you if you don't have a script AnasBahauddin1978 715 — 4y
0
I don't even know how to code so don't ask me. shotpaper7 -5 — 4y
0
Please re-look at my post - i've included my code User#34345 0 — 4y

2 answers

Log in to vote
0
Answered by 4 years ago

I am unable to confirm what you are doing wrong since you did not post any code.

However, the best way to handle this is by using remote events. Using a server script, you can use :FireAllClients(message) to tell the clients to update their text to the message given. This way, it will be simultaneous.

0
Ive included some code now, please review it again. thankyou :) User#34345 0 — 4y
Ad
Log in to vote
0
Answered by 4 years ago

Hello. I do not have a direct answer, but I do have a compiled list of reasons why this may happen: - The code is located in a localscript, and will only update for the client - You did not reference the GUI correctly

for i,v in pairs(game.Players:GetChildren()) do
    v.PlayerGui.Label.Text = "Desired text change here"
end

Do keep in mind this is not a direct fix and is more insight as to why this may be happening.

Answer this question