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

How do i make it so it detects gamepasses?

I have a donation game but it says that i dont own the gamepass (I mean like made it) but here is the code

script.Parent.MouseButton1Click:Connect(function()
	local text = script.Parent.Parent.Text
	
	local success, err = pcall(function()
		script.Value.Value = game.MarketplaceService:GetProductInfo(text).Pr
	end)
	
	if success then
		if game.MarketplaceService:GetProductInfo(text).Creator.Name == game.Players.LocalPlayer.Name then
			game.ReplicatedStorage.Edit:FireServer(script.Parent.Parent.Name, script.Parent.Parent.Text)
		else
			script.Parent.Parent.Parent.Parent.TextLabel.Text = "Make sure you created the item you are submitting!"
			wait(2)
			script.Parent.Parent.Parent.Parent.TextLabel.Text = ""
		end
	else
		script.Parent.Parent.Parent.Parent.TextLabel.Text = "ID isn't valid!"
		wait(2)
		script.Parent.Parent.Parent.Parent.TextLabel.Text = ""
	end
end)

1 answer

✓ Accepted answer

You haven't put an id in? Here's a script for checking if you own a gamepass:

local id = --Type your gamepass id here.

game.Players.PlayerAdded:Connect(function(plr)
  if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(
plr.UserId,id) then --checks if player owns gamepass
--Gamepass function here, such as giving VIP.
end)

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