I have a script in workspace that is supposed to put a VIP item in the player's StarterGear if they own a gamepass. This works in studio, but not when I play on an actual server from the places in my game (universe). But even stranger, it works in my testing place perfectly, but not in any of the places in the actual game.

I'm guessing the problem has to do with PlayerAdded and something messes up on joining, maybe the map is loading or something.

Please help, this is kind of urgent and I have not much of an idea on how to solve this.

This is the script:

local passId = 430308264

local potato = game.Lighting:WaitForChild("Jetpack")


function isAuthenticated(player) 
    return game:GetService("MarketplaceService"):PlayerOwnsAsset(player, passId)
end

game.Players.PlayerAdded:connect(function(player)
    if isAuthenticated(player) then
        potato:Clone().Parent = player.StarterGear
		print(player.Name .. " HAS BOUGHT A JETPACK!")
    end
end)

2 comments

0

Pls do not use Lighting to store item, use server storage

0

What's so bad about lighting? I would, except when I would have to painstakingly edit every shop script in my game to Storage.