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

Help with .Changed on a value?

Asked by
FiredDusk 1466 Moderation Voter
7 years ago

I have the IntValue called "ShowTime" in Workspace and the value does change in another script. I am wanting the text to change to whatever the value is.

game.Workspace.ShowTime.Changed:connect(function()
    script.Parent.Text = game.Workspace.ShowTime.Value
end)

0
Any errors? xxxXMrsAwesomeXxxx 70 — 7y
0
No FiredDusk 1466 — 7y

1 answer

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

misinterpreted your question - this is a functioning script now. I have 2 solutions for u

game.Workspace.ShowTime.Changed:connect(function()
    script.Parent.Text = "" .. game.Workspace.ShowTime.Value
end)

first method uses string concatenation ( two dots operator ".." connects a string to a number value and results in a string)

game.Workspace.ShowTime.Changed:connect(function()
    script.Parent.Text = tostring(game.Workspace.ShowTime.Value)
end)

second method uses the tostring function to convert whatever is in the ()s to a string

0
Use codeblocks. xxxXMrsAwesomeXxxx 70 — 7y
1
sorry about that, didn't know codeblocks were a thing until right now! edited my post for you. patrline5599 150 — 7y
0
Also, this would be incorrect as you don't need to put Showtime.Value. The function already knows it's a value changing. xxxXMrsAwesomeXxxx 70 — 7y
Ad

Answer this question