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

How to connect a value and textbox?

Asked by
sw00d 5
8 years ago

Hi, I'm working on a game currently, and I'm trying to make a timer gui. Changing the text directly just makes it reset when a player dies, and won't match up if another player joins the game.

I thought of connecting it to a StringValue, but I'm not totally sure how to do this.

I'm fairly new to Lua, any advice?

0
"Changing the text directly just makes it reset when a player dies" Sounds like you're altering the StarterGui not the PlayerGui elements. "and won't match up if another player joins the game." And it sounds like you're looping through players first then looping through their time. "I thought of connecting it to a StringValue" Use a number value, change that value with the script, M39a9am3R 3210 — 8y
0
In the Gui script, just listen to the Changed event. Anyway, we can't completely help you unless you show us your attempt. M39a9am3R 3210 — 8y

1 answer

Log in to vote
1
Answered by 8 years ago
Edited 8 years ago

Simply run a for loop in a script in Workspace to update everyone's timer when it counts down. This way you don't even need an IntValue.

for x = 10,1,-1 do
    for i,v in pairs(game.Players:GetPlayers()) do
        v.PlayerGui.ScreenGui.TextLabel.Text = tostring(x)
    end
    wait(1)
end
Ad

Answer this question