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

How to fix my health gamepass it didn't work and the id is right?

Asked by 2 years ago
wait(2)
local passId = 11357769

function authenticate(player) 
return game:GetService("GamePassService"):UserOwnsGamePassAsync(player, passId)
end 

game.Players.PlayerAdded:connect(function(plr) 
te = authenticate(plr)   
if te then        
print(plr.Name .. " has bought the game pass with id " .. passId)  
plr.Character.Humanoid.MaxHealth = 600
plr.Character.Humanoid.Health = 600  
end
if te == false then
print("Nope")
plr.Character.Humanoid.MaxHealth = 300
plr.Character.Humanoid.Health = 300
end
end)

function respawned(char)
e = char.Name
plr = game.Players[e]
te = authenticate(plr)
if te then
print(plr.Name .. " has respawned, renewing health.")
char.Humanoid.MaxHealth = 600
char.Humanoid.Health = 600
end
if te == false then
print("Nope")
plr.Character.Humanoid.MaxHealth = 300
plr.Character.Humanoid.Health = 300
end
end

1 answer

Log in to vote
0
Answered by 2 years ago

Idk, but i’ll try it:

local MS = game:GetService(”MarketplaceService”)
local id = 1234567 — Your Id here

game.Players.PlayerAdded:Connect(function(plr)
local owns = MS:UserOwnsGamepassAsync(plr, id)

if owns == true then 
game.Players.LocalPlayer.Character.Humanoid.MaxHealth = 600
wait()
game.Players.LocalPlayer.Character.Humanoid.Health = 600
else 
print(„Don’t own gamepass“)
game.Players.LocalPlayer.Character.Humanoid.MaxHealth = 300
wait()
game.Players.LocalPlayer.Character.Humanoid.Health = 300
end
end)

that should be working

Ad

Answer this question