So my issue is I made a game pass that gives more cash per lap om a racing game the normal. But even players without the VIP (I tested on an alt) still get the extra 300 per lap. VIP is supposed to start as false but become true when the game detects a game pass is owned but it counts It as true for some stupid reason.
GamePassCheck script
vip = false
game.Players.PlayerAdded:connect(function(plyr)
local gamePassService = game:GetService("GamePassService")
if gamePassService:PlayerHasPass(plyr,12146561) then
vip = true
end
end)
LapCounter Script
function onTouch(part)
local searcher = part.Parent:findFirstChild("Humanoid")
if searcher ~= nil then
local finder = game.Players:findFirstChild(part.Parent.Name)
if finder == nil then return end
if finder.Cheeze.Value == 3 then
finder.leaderstats.Laps.Value = finder.leaderstats.Laps.Value + 1
finder.leaderstats.Cash.Value = finder.leaderstats.Cash.Value + 500
finder.Cheeze.Value = 0
if vip == true then
finder.leaderstats.Cash.Value = finder.leaderstats.Cash.Value + 300
end
end
end
end
script.Parent.Touched:connect(onTouch)
Can someone explain what I did wrong?

1 comment
Another note, PlayerHasPass is also deprecated use :UserOwnsGamePassAsync() instead