Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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.

2 comments

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.

0

Thanks

1 answer

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)

This discussion is preserved as it was. New answers, comments, and votes are closed.