im trying to play a song when the player joins how would I do this?
You can figure out who the creator of a game is using the CreatorId property of game. CreatorId, however, doesn't always return a player's userId, therefore, it's best to check to make sure that the enumerated type CreatorTypeis "user"
local function CreatorId(playerId) if playerId == game.CreatorId and game.CreatorType == Enum.CreatorType.User then return true end end -- The function would simply return true if the argument passed is in fact the creator's userId, --and that the creator is a USER.... otherwise returns nil.
You would then use the **PlayerAdded **event to call the function CreatorId
, with the userId property of every new player as argument, and execute whatever code comes next based on the whatever is returned.
local function CreatorId(playerId) if playerId == game.CreatorId and game.CreatorType == Enum.CreatorType.User then return true end end game:FindService('Players').PlayerAdded:connect(function (player) if CreatorId(player.userId) then --path to sound, play end end)