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

Surfacegui not toggling music when clicked. Help?

Asked by 5 years ago

When I click the button to toggle it, it does nothing My hierarchy is workspace>Furniture>Radio>Sign>SurfaceGui>TextButton>LocalScript

script.Parent.MouseButton1Click:connect(function()
    if script.Parent.Parent.Parent.Parent.Music.Volume == 0.8 then
        script.Parent.Text = ('(OFF)')
        script.Parent.Parent.Parent.Parent.Music.Volume = 0
    else
        script.Parent.Text = ('(ON)')
        script.Parent.Parent.Parent.Parent.Music.Volume = 0.8
    end

end)

0
You need to put the SurfaceGui into the StarterGui and Adornee to the Part Ince_FS 13 — 5y

1 answer

Log in to vote
0
Answered by
starmaq 1290 Moderation Voter
5 years ago

Well.... why is this in workspace? all uis objects have to be put in the StarterGui service in order for them to work, and since they are local, you gotta use a local script not a server script (a server script is pretty much the normal script you use most of the times)

Ad

Answer this question