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

Custom Music SurfaceGUI not working? [Solved]

Asked by 3 years ago
Edited by JesseSong 3 years ago

So here's the deal.

I have a custom music SurfaceGUI that I'm trying to make for a radio. The problem is that changing the id doesn't work

local Play = script.Parent.Frame.PlayButton
local change = script.Parent.Frame.Change
local sound = game.Workspace.Radio.AudioBrick.Sound

function playpause()
    if sound.Playing == true then
        sound.Playing = false
        Play.Text = "Play"
    else if sound.Playing == false then
            sound.Playing = true
            Play.Text = "Pause"
        end
    end
end

function idchange()
    local id = script.Parent.Frame.Input.Text --<< this part gives me trouble
    sound.SoundId = "rbxassetid://" .. id
    sound.Playing = false
    Play.Text = "Play"
    sound.TimePosition = 0
end

Play.MouseButton1Click:Connect(playpause)
change.MouseButton1Click:Connect(idchange)

There's no error in the coding, however, each time i activate idchange, it doesn't detect a change in input. The TextButton will originally say "Music ID", but when i paste an audio ID into it and activate function idchange, it inputs "Music ID" instead of what i typed into the Text Button.

0
Turns out I was using a normal script instead of a localscript. DarkAndLight64 0 — 3y

Answer this question