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

[Not answered yet] How do i make it so if people buy my vip game pass they get money?

I have tried editing a already made code for something else but this still doesnt work the script also has a IntVaule where i put the game pass id to make it easier

--------------------
--| WaitForChild |--
--------------------

-- Waits for parent.child to exist, then returns it
local function WaitForChild(parent, childName)
	assert(parent, "ERROR: WaitForChild: parent is nil")
	while not parent:FindFirstChild(childName) do parent.ChildAdded:wait() end
	return parent[childName]
end

-----------------
--| Variables |--
-----------------

local GamePassService = Game:GetService('GamePassService')
local PlayersService = Game:GetService('Players')
local Leaderboard = Game:GetService('Leaderstats')
local LightingService = Game:GetService('Lighting') --TODO: Use new data store service once that exists

local GamePassIdObject = WaitForChild(script, 'GamePassId')


-----------------
--| Functions |--
-----------------

-- When a player with the game pass joins, give them $25,000
local function OnPlayerAdded(player)
	if GamePassService:PlayerHasPass(player, GamePassIdObject.Value) then
		player:findFirstChild("Leaderstats").Credits.Value = "25000"
		
		end
	end
end

1 comment

0

still not solved

1 answer

Change Credits to whatever the Money is Be it "Money, Points" Or it can Be credits still this may not fix your problem but it is the Only thing I can Figure out is wrong with it.

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