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

How would you make an item giver for the player that owns the gamepass?

Asked by
Scaii_0 145
5 years ago

So right now I have a local script in the PlayerScripts that says this:

local p = game.Players.LocalPlayer

p.CharacterAdded:Connect(function(c)
    if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(p,2380022448) == true then
        --item.Parent = player backpack
    end
end)

Is it correct? I'm new to the UserOwnsGamePassAsnyc bit.

0
You check their UserId. So p.UserId, and no need for the == true + you should do checks on the server as well as cloning toe tool on the server. User#19524 175 — 5y
0
Thanks Scaii_0 145 — 5y

1 answer

Log in to vote
0
Answered by
Epuuc 74
5 years ago

You could also make this in a regular script, placed in the ServerScriptService.

game.Players.PlayerAdded:Connect(function(p)
    p.CharacterAdded:Connect(function()
        if game:GetService("MarketPlaceService"):OwnsGamePassAsync(p,2380022448) then
            item.Parent = p.Backpack
        end
    end)
end)
Ad

Answer this question