I made a game, the gamepasses show up when the server is relatively empty, but after that they do not. I have it set up so it checks to see if the player owns the gamepass, and then copies the model from Lighting to put it in the player's inventory.

Script:

game.Players.PlayerAdded:connect(function(player) while true do if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.userId, 4988705) then if player.Backpack:FindFirstChild("Broomstick") == nil and player.Character:FindFirstChild("Broomstick") == nil then print(player.Name .. " got an item!") local b = game.Lighting:FindFirstChild("Broomstick"):Clone() b.Parent = player.Backpack end end wait(1)
end end)

Broomstick is the name of the tool in Lighting that is being cloned. Why is this unreliable?

8 comments

0

Please use serverstorage

0

Use serverstorage for what? The tools?

0

Can you put your code in a code block

0

Don't use lighting as a storage, use ServerStorage for the tools, or anything honestly.

0

Seems kinda excessive that you have an endless loop running for each player that joins constantly checking if they own the pass and all, I would change it to CharacterAdded or a button

0

Try this: game:GetService("MarketplaceService"):PlayerOwnsAsset(player.userId, 4988705)

0

@ above I believe UserOwnsGamepassAsync is a better way of doing it

0

yes and userId is deprecated