Can someone help me with this Health button?
ok, I have a wall that has a humanoid in it with 500 start health per. block. and max health 1000 per. block.
the blocks will change their transparency when their health hits 0 (works)
I have a button that when clicked will add 500 health to the humanoid in each block if the humanoid health is less than 1000
the first thing that I want the button to do is check if the player is the tycoon owner, and then if he has enough money. the subtract the cash and add 500 health to each block in the wall.
the button is not working and I have no errors.
can someone look at this and see if I forgot something
thanks a lot!
01 | script.Parent.ClickDetector.MouseClick:connect( function (hit) |
02 | local player = game.Players:GetPlayerFromCharacter(hit.Parent) |
04 | if script.Parent.Parent.Parent.Parent.Owner.Value = = player then |
05 | local cashmoney = game.ServerStorage.MoneyStorage:FindFirstChild(player.Name) |
06 | if cashmoney ~ = nil then |
07 | if cashmoney.Value > = script.Parent.Parent.Price.Value then |
08 | cashmoney.Value = cashmoney.Value - script.Parent.Parent.Price.Value |
09 | for i,v in pairs (script.Parent.Parent.PurchasedObjects.BaseWall:GetChildren()) do |
10 | if not v:IsA( "Script" ) then |
11 | if v.Humanoid.Health > 1000 then |
12 | v.Humanoid.Health = v.Humanoid.Health + 500 |