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

The Text won't change when the textbutton is clicked?

Asked by
yoshi8080 445 Moderation Voter
9 years ago

I was making something to change the volume of a song for a surfacegui. Once I pressed a button to change the volume sound/pitch, it stays at one, while the sound/pitch changes. Help?

Heres the volume label script similar to the pitch

local sound = game.Workspace.SongBoard.Song
local pitchtext = game.Workspace.SongBoard.Board.Background.VolumeLevel
pitchtext.Text = sound.Volume

Here's the button that'll add the volume similar to subtracting

local sound = game.Workspace.SongBoard.Song
script.Parent.MouseButton1Click:connect(function()
sound.Volume = sound.Volume +.1
end)

Can someone tell me why the text won't change when clicking the button to add volume?

1 answer

Log in to vote
1
Answered by
Validark 1580 Snack Break Moderation Voter
9 years ago

You didn't tell it to change.

After increasing the volume by .1, you need to update the text:

local sound = game.Workspace.SongBoard.Song

local pitchtext = game.Workspace.SongBoard.Board.Background.VolumeLevel

script.Parent.MouseButton1Click:connect(function()
    sound.Volume = sound.Volume +.1
    pitchtext.Text = sound.Volume
end)

Ad

Answer this question