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

This simple GamePass script isn't working... Can anybody help? [UNSOLVED]

Asked by
Discern 1007 Moderation Voter
10 years ago

So there are no output errors, and my problem is that the tool named "Customized" is not being cloned into the player's backpack if they have this gamepass.

The tool "Customized" is located in ServerStorage.

This is in a regular Script inside ServerScriptService.

game.Players.PlayerAdded:connect(function(player)
    player.CharacterAdded:connect(function(character)
        if game:GetService("GamePassService"):PlayerHasPass(player, 187979130) then
            game.ServerStorage.Customize:Clone().Parent = player:WaitForChild("Backpack")
        end
    end)
end)

1 answer

Log in to vote
0
Answered by
dyler3 1510 Moderation Voter
10 years ago

You have 1 simple error in your script. For checking if someone has a certain badge, you have to use the players id. So line 3 should look like this:

if game:GetService("GamePassService"):PlayerHasPass(player.userId, 187979130) then

That's the only error I noticed. If you have any questions or problems, please leave a comment below. Hope I helped :P Update: I'll just provide the whole script for you

game.Players.PlayerAdded:connect(function(player)
        if game:GetService("GamePassService"):PlayerHasPass(player.userId, 187979130) then
            game.ServerStorage.Customize:Clone().Parent = player:WaitForChild("Backpack")
        end
end)

Idk why it wouldn't work. If this doesn't work, then there's probably an error somewhere else...

0
Didn't fix it. Discern 1007 — 10y
0
That's what my script looks like. Discern 1007 — 10y
Ad

Answer this question