Im trying to make a Premium Benefits, where if you have premium you get 125 health but when i try i get this error
R8698f290S9592b4366C3092M7916.MainScript:15: attempt to index nil with ‘FindFirstChild’ - Server -
And this is the code
game:GetService(“Players”).PlayerAdded:Connect(function(player)
local billboardgui = game:GetService(“ServerStorage”):WaitForChild(“BillboardGui”)
player.CharacterAdded:Connect(function(players)
if players.Head:FindFirstChild(“BillboardGui”) then
else
local clonedgui = billboardgui:Clone()
while true do wait()
if player.MembershipType == Enum.MembershipType.Premium then
player.PlayerGui.Premium.ImageButton.Visible = true
clonedgui.TextLabel.ImageLabel.Visible = true
wait(5)
local HealthMax = player:FindFirstChild("Humanoid"):FindFirstChild("MaxHealth")
HealthMax = 125
player:FindFirstChild("Humanoid").Health = 125
end
if player.Character:FindFirstChild("Head") ~= nil then
clonedgui.TextLabel.Text = player.leaderstats.TimeAlive.Value
local Head = player.Character.Head
clonedgui.TextLabel.TextColor3 = Color3.fromRGB(236,236,236)
clonedgui.Parent = game.Workspace:WaitForChild(player.Name).Head
end
end
end
end)
end)