Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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

✓ Accepted answer

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)

This discussion is preserved as it was. New answers, comments, and votes are closed.