Simply put, I have a loop in my server script that counts intermission up and I want my local script that is in a textlabel to display 30 -intermission. I don't know how to share a variable from a script to a local script. How do I?
COMMUNITY QUESTION
How do you share a variable from a Script to Local Script?
1 answer
You could make an Int Value inside the Script and set its value to 30, so while the server script counts intermission, value would go down by 1 every second or whatever time you have chosen to apply. The local script would find that value and change the GUI's text to the value's value. Here's a sample how it would look.
game:GetService("ServerScriptService").IntermissionServerScript.IntValue.Changed:Connect(function(value) -- Checks for ServerScriptService and finds the IntValue inside your Intermission server script. Every time the value changes
textlabel.Text = value -- The text gui changes into the IntValue's value.
end)
3 comments
0
Intvalues are bad practices, exploiters can hax it if it is written 'horribly'. id go for remotes
0
just use a remote event lol
0
also the client or "LocalScript" cant access ServerScriptService since its only used for the server
This discussion is preserved as it was. New answers, comments, and votes are closed.

4 comments
You would use a remote event to tell all players to start a count down in a local script .
^ bruh, I was gonna say that
Ok! I'll do that!
Kingdom5's answer of remotes event.