How could I make a 2x coins gamepass with the way my game is setup?

  1. What do you want to achieve? I want to add a 2x coins gamepass to my game, but the way ive set it up idk if its possible.

  2. What is the issue? I store the coin value inside workspace and update that to a gui (its a 1 player game)

  3. What solutions have you tried so far? Nothing yet, I don’t know what i could do to make this work

If the value is in workspace and the gamepass makes all coins you get worth 2x, how would i do this?

1 Like
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

1 Like

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)

1 Like

same thing, different method
i do prefer your method though
nice formatting

1 Like

Right here you could add a call to set a bool to true. Times2.Value = true
Then when you figure your coins given amount, you can check the bool.

1 Like