I have a script that is updating a score every second, and if you have a gamepass, it will add 2x as much. However, I know that this script will only detect the game pass when the player first joins. How would I be able to make it to where it also knows when the play purchases the gamepass, so that the player won’t have to rejoin.
local MarketplaceService = game:GetService("MarketplaceService")
game.Players.PlayerAdded:Connect(function(plr)
local char = plr.CharacterAdded:Wait()
local humanoid = char:WaitForChild("Humanoid")
if MarketplaceService:UserOwnsGamePassAsync(plr.UserId, 91421613) then
while true do
wait(1)
plr.leaderstats.JumpP.Value = plr.leaderstats.JumpP.Value + 2
if plr.jumpSet.Value == false then
humanoid.JumpPower = plr.leaderstats.JumpP.Value
end
end
else
while true do
wait(1)
plr.leaderstats.JumpP.Value = plr.leaderstats.JumpP.Value + 1
if plr.jumpSet.Value == false then
humanoid.JumpPower = plr.leaderstats.JumpP.Value
end
end
end
end)
I thought about making the value an IntValue and having a script that changes it’s value if the player bought or owns the gamepass, however it wasn’t working. I also assume there is probably an easier way than doing that, and would like to learn how to do it.