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

Whats wrong with this script?

Asked by
DanzLua 2879 Moderation Voter Community Moderator
10 years ago

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.

0
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 474 — 10y
0
@GoldenPhysics it didnt work DanzLua 2879 — 10y

Answer this question