Try this one.
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
loadHealth(player)
end)
end)
local MarketplaceService = game:GetService(“MarketplaceService”)
local GampassID = 18664894
local humanoid = game.Players:WaitForChild(“Humanoid”)
local function loadHealth(player)
game.Players.PlayerAdded:connect(function(plr)
plr.CharacterAdded:connect(function()
local human = plr.Character:WaitForChild(“Humanoid”)
local character = player.Character
local hasPass = false
local success, message = pcall(function()
hasPass = MarketplaceService:UserOwnsGamePassAsync(player.UserId, GampassID)
if hasPass and human then
human.MaxHealth = 150
end
end)
end)
end)
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
loadHealth(player)
end)
end)