local marketplace_service = game:GetService('MarketplaceService')
local gamepass_id = nil --change to gamepass id
local owns_gamepass = marketplace_service:UserOwnsGamePassAsync(PlayerID,gamepass_id)
--arg 1 is userid
--if the player owns it, it will return as true
if owns_gamepass then
--what ever would happen
end
heres a quick example i made you can use these inside of the coin script
also its not an amazing idea to put the value inside of workspace
Not sure what you’re asking here … here is how to make a gamepass:
Script
-- server script in ServerScriptService
local Players = game:GetService("Players")
local MarketPlaceService = game:GetService("MarketplaceService")
local gamepassID = ????? -- GamePass
function Spawned(player)
task.wait(1.1) local HasGamepass = false
local success, message = pcall(function()
HasGamepass = MarketPlaceService:UserOwnsGamePassAsync(player.userId, gamepassID)
end)
if not success then
warn("Checking Gamepass "..tostring(message))
return
end
if HasGamepass == true then -- print("Adding GamePass")
-- set something to true to test off for x2
end
end
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function()
Spawned(player)
end)
end)