This script is suppose to give players with a certain gamepass sparkles when they join the game. when i play the game it doesn't work, also there are no errors in the output.
local GamePassService = Game:GetService('GamePassService')
local GamePassIdObject = script:WaitForChild('GamePassId')
local function OnCharacterAdded(char)
local smoke = Instance.new("Sparkles", char:WaitForChild("Torso"))
end
local function OnPlayerAdded(player)
if GamePassService:PlayerHasPass(player, GamePassIdObject.Value) then
player.CharacterAdded:connect(OnCharacterAdded)
end
end
Game:GetService("Players").PlayerAdded:connect(OnPlayerAdded)
Thanks.

2 comments
Try "repeat wait(.5) until player.Character" in addition to the character added event, so if the character has already loaded, it'll put the sparkles back in. You could also put the sparkles in one time, then add it when the character is added after the humanoid dies.
@GoldenPhysics it didnt work