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

Everyone in the server can hear the music why?

Asked by 4 years ago

I'm making a loading screen but everyone can hear the music even those not on the loading screen what do I do?

local function playerAdded(player)
    wait(2)
    script.Parent.Text = "loading."
    script.Parent.Parent.TextButton.LocalScript.LoadingScreen.Playing = true
    wait(.7)
    script.Parent.Text = "loading.."
    wait(.7)
    script.Parent.Text = "loading..."
    wait(.7)
    script.Parent.Text = "loading"
    wait(.7)
    script.Parent.Text = "loading."
    wait(.7)
    script.Parent.Text = "loading.."
    wait(.7)
    script.Parent.Text = "loading..."
    wait(.7)
    script.Parent.Text = "loading"
    wait(.7)
    script.Parent.Text = "loading."
    wait(.7)
    script.Parent.Text = "loading.."
    wait(.7)
    script.Parent.Text = "loading..."
    wait(.7)
    script.Parent.Text = "loading"
    wait(.7)
    script.Parent.Text = "loading."
    wait(.7)
    script.Parent.Text = "loading.."
    wait(.7)
    script.Parent.Text = "loading..."
    wait(.7)
    script.Parent.Text = "loading"
    wait(.7)
    script.Parent.Text = "loading."
    wait(.7)
    script.Parent.Text = "loading.."
    wait(.7)
    script.Parent.Text = "loading..."
    wait(.7)
    script.Parent.Text = "loading"
    wait(.7)
    script.Parent.Text = "loading."
    wait(.7)
    script.Parent.Text = "loading.."
    wait(.7)
    script.Parent.Text = "loading..."
    wait(.7)
    script.Parent.Text = "loading"
    wait(.7)
    script.Parent.Text = "loading."
    wait(.7)
    script.Parent.Text = "loading.."
    wait(.7)
    script.Parent.Text = "loading..."
    wait(.7)
    script.Parent.Text = "loading"
    wait(.7)
    script.Parent.Text = "loading."
    wait(.7)
    script.Parent.Text = "loading.."
    wait(.7)
    script.Parent.Text = "loading..."
    wait(.7)
    script.Parent.Text = "loading"
    wait(.7)
    script.Parent.Text = "loading."
    wait(.7)
    script.Parent.Visible = false
    script.Parent.Parent.TextButton.Visible = true

end




game.Players.PlayerAdded:Connect(playerAdded)

for _, player in pairs(game.Players:GetPlayers()) do
    playerAdded(player)
end

1 answer

Log in to vote
0
Answered by 4 years ago

Instead of making the loading screen invisible, destroy it so others cannot activate the audio.

This issue occurs because it is a regular script and not a localscript.

local function playerAdded(player)
    wait(2)
    script.Parent.Text = "loading."
    script.Parent.Parent.TextButton.LocalScript.LoadingScreen.Playing = true
    wait(.7)
    script.Parent.Text = "loading.."
    wait(.7)
    script.Parent.Text = "loading..."
    wait(.7)
    script.Parent.Text = "loading"
    wait(.7)
    script.Parent.Text = "loading."
    wait(.7)
    script.Parent.Text = "loading.."
    wait(.7)
    script.Parent.Text = "loading..."
    wait(.7)
    script.Parent.Text = "loading"
    wait(.7)
    script.Parent.Text = "loading."
    wait(.7)
    script.Parent.Text = "loading.."
    wait(.7)
    script.Parent.Text = "loading..."
    wait(.7)
    script.Parent.Text = "loading"
    wait(.7)
    script.Parent.Text = "loading."
    wait(.7)
    script.Parent.Text = "loading.."
    wait(.7)
    script.Parent.Text = "loading..."
    wait(.7)
    script.Parent.Text = "loading"
    wait(.7)
    script.Parent.Text = "loading."
    wait(.7)
    script.Parent.Text = "loading.."
    wait(.7)
    script.Parent.Text = "loading..."
    wait(.7)
    script.Parent.Text = "loading"
    wait(.7)
    script.Parent.Text = "loading."
    wait(.7)
    script.Parent.Text = "loading.."
    wait(.7)
    script.Parent.Text = "loading..."
    wait(.7)
    script.Parent.Text = "loading"
    wait(.7)
    script.Parent.Text = "loading."
    wait(.7)
    script.Parent.Text = "loading.."
    wait(.7)
    script.Parent.Text = "loading..."
    wait(.7)
    script.Parent.Text = "loading"
    wait(.7)
    script.Parent.Text = "loading."
    wait(.7)
    script.Parent.Text = "loading.."
    wait(.7)
    script.Parent.Text = "loading..."
    wait(.7)
    script.Parent.Text = "loading"
    wait(.7)
    script.Parent.Text = "loading."
    wait(.7)
    script.Parent:Destroy()
end




game.Players.PlayerAdded:Connect(playerAdded)

for _, player in pairs(game.Players:GetPlayers()) do
    playerAdded(player)
end

This should fix it.

0
Please incorporate a for loop to help him make more efficient code Ziffixture 6913 — 4y
0
they didn't ask for a loop. TheMaster9245 41 — 4y
Ad

Answer this question