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

Can anyone help me with this regeneration button?

Asked by 9 years ago

ok, here is what I have.

Inside workspace I have Child (Tycoons)

Inside Tycoons I have Child (BrightBlue)

Inside BrightBlue I have Child (Purchases)

Inside Purchases I have Child (BaseWall)

Inside BaseWall I have Child (Model)x100 or so

Inside each Model I have Child (Humanoid) with health at 1000

Now, I need a script that will make the Humanoid Health set at 1000 ( the blocks can be killed already)

The script will be attached to a button here is were it is located

Inside workspace I have Child (Tycoons)

Inside Tycoons I have Child (BrightBlue)

Inside BrightBlue I have Child (Purchases)

Inside Purchases I have Child (RegenerationBuilding)

Inside RegenerationBuilding I have Child (Buttons)

Inside Buttons I have Child (Regenerate Base Walls - $Price (this is the button))

Inside the Button I have Child (script) Named Regeneration

I know it was long but I hope you understand what I am asking.

Here is the script that I have


objects = {} teamcolor = BrickColor.new(script.Parent.Name) wait(1) script.Parent.Essentials.Spawn.TeamColor = teamcolor script.Parent.Essentials.Spawn.BrickColor = teamcolor script.Parent.Touched:connect(function(hit) local player = game.Players:GetPlayerFromCharacter(hit.Parent) if player ~= nil then if script.Parent.Owner.Value == player then if hit.Parent:FindFirstChild("Humanoid") then if hit.Parent.Humanoid.Health > 0 then local cashmoney = game.ServerStorage.MoneyStorage:FindFirstChild(player.Name) if cashmoney ~= nil then cashmoney.Value = cashmoney.Value + script.Parent.Cash.Value script.Parent.Cash.Value = 0 end end end end end end) Workspace.Tycoons.BrightBlue.Purchases.BaseWall:WaitForChild("BaseWall") for i,v in pairs(script.Parent.Parent.BaseWall:GetChildren()) do if v:FindFirstChild("Model") then v.Humanoid.Health = 1000 v.Part.Transparency = 1 v.Part.CanCollide = false end end) -- After 30 seconds, allow the model to be regenerated again wait(30)

This script is designed to make sure that the person clicking it is the owner of the base, alive, has the cash to buy it and a 30 sec timer.

that's all I can think of if you have any other ideas feel free to add....

Thanks for what ever help you can give

0
ok, i just noticed that the transparency does not need to be there the script that i have that allows them to be killed takes care of that i just need the healthe rchanged to 1000 snipers0076 5 — 9y
0
Is the MaxHealth of the Humanoids 1000? DevChris 235 — 9y
0
yes snipers0076 5 — 9y
0
Sorry, im wrong.. i want the health to be set at 500, because i have an upgrad to give it the max health of 1000... but the max health is 1000 and normal is 500 snipers0076 5 — 9y
View all comments (2 more)
0
so the script will need to be able to set it to 500 if not upgraded and 1000 if upgraded snipers0076 5 — 9y
0
i know a long way to make the script, nameing each model and pathing it all out seperate but i dont want to take that route.. i want a code that i can do it all in a short code snipers0076 5 — 9y

1 answer

Log in to vote
0
Answered by 9 years ago

Instead of v.Humanoid.Health = 1000 i would recommend v.Humanoid.Health = v.Humanoid.MaxHealth .

0
and i dont get your problem other than that.. dudemanloserr 15 — 9y
Ad

Answer this question