So my problem is that it sometimes works for me only and sometimes for everyone. It's just confusing. Actually, a sound should get on if I join the game or a player joins the game when I'm in-game. The sound should also turn off when I leave the game. So here's the script:
sound = game.Workspace.Sound.Music
game.Players.PlayerAdded:connect(function(p)
if game.Players:findFirstChild("Cheater") then
sound:Stop()
sound.Volume = 0
wait(1)
sound:Play()
while sound.Volume < 1 do
sound.Volume = sound.Volume + 0.01
wait(0.1)
end
end
end)
game.Players.PlayerAdded:connect(function(p)
if p.Name == "Cheater" then
sound:Stop()
sound.Volume = 0
wait(1)
sound:Play()
while sound.Volume < 1 do
sound.Volume = sound.Volume + 0.01
wait(0.1)
end
end
end)
game.Players.PlayerRemoving:connect(function(p)
if p.Name == "Cheater" then
sound:Stop()
end
end)
|