I'm trying to add music to my game so it starts for all players individually instead of one audio running running already when a player joins, (Ex: Server started 2 minutes ago, another player joins halfway through the audio playing.)
I've tried adding this at the end
if player.PlayerAdded then sound1:Play()
but it doesn't seem to work help?
Script
local Players = game:GetService("Players") function onPlayerAdded(player) print(player.Name .. " has entered the game") end Players.PlayerAdded:Connect(onPlayerAdded) for _,player in pairs(Players:GetPlayers()) do onPlayerAdded(player) end
If you're saying that you want the music to play only for the player when they join the game, then you can do something like this in a LocalScript
.
local player = game.Players.LocalPlayer local sound = Instance.new("Sound",player) sound.SoundId = "rbxassetid://"..484369080 --the ID of your sound. sound:Play()
If I'm interpreting your question wrong, please comment so I can try to help.