Hi, I'm currently trying to make a health game-pass, but it doesn't seem to be working, When I go into text and developer console, it says
attempt to concatenate local 'humanoid' (a nil value)
The script is server sided if your wondering, here is the script:
Service = game:GetService("MarketplaceService")
gamePassId = 5207158
game.Players.PlayerAdded:Connect(function(player)
local userId = player.UserId
if Service:UserOwnsGamePassAsync(userId, gamePassId) then
print("Player owns Health pass")
local humanoid = game.Workspace:FindFirstChild(player.Name)
if humanoid == nil then
print("Failure to set health to " .. humanoid)
else
humanoid.Humanoid.MaxHealth = 150
humanoid.Humanoid.Health = 150
while true do
if humanoid.Humanoid.Health <= 0 then
wait(7)
humanoid.Humanoid.MaxHealth = 150
humanoid.Humanoid.Health = 150
else
print("Humanoid is fine, Continue")
end
end
end
end
end)
If you are wondering what this does, The script gives the Humanoid and extra 50 health when they spawn. If you can help, It'll be greatly appreciated.

1 comment
Tysm