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

Why wont this music button work?

Asked by
Jurdy 0
10 years ago
player = game.Players.LocalPlayer
button = script.Parent
song = script.Parent.Parent.Parent.Parent.forest
playing = false

button.MouseButton1Click:connect(function()
    button.Text = "ON"
    if playing == false then
        song:Play()
        playing = true
    elseif
        playing == true then
        song:Stop()
        button.Text = "OFF"
        playing = false
    end
end)

--Works in solo, doesnt work in game. please help!

1 answer

Log in to vote
0
Answered by
Tkdriverx 514 Moderation Voter
10 years ago

The code has to be in a LocalScript for "game.Players.LocalPlayer" to work.

0
It is in a localscript Jurdy 0 — 10y
0
I don't see any problems. What does the output say in the server? (Press F9 to open the console in your game and click "Server Console" tab) Tkdriverx 514 — 10y
0
Solved! Jurdy 0 — 10y
Ad

Answer this question