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
still not solved