Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 10 years ago

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
0
still not solved Alpha_Toon 57 — 10y

1 answer

Log in to vote
0
Answered by
IcyEvil 260 Moderation Voter
10 years ago

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.

Ad

Answer this question