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

Why is this not working?

Asked by 9 years ago
while wait() do
        if script.Parent.Value.Value < 0 then
            script.Parent.Text = "You lost...restarting."
            wait(0.01)
            script.Parent.Parent.OHealth.Value.Value = "4000"
            script.Parent.Parent.OHealth.Text = "OPPONENT'S HEALTH: "..script.Parent.Parent.OHealth.Value.Value
            script.Parent.Value.Value = "4000"
            script.Parent.Text = "HEALTH: "..script.Parent.Value.Value
            else script.Parent.Text = "HEALTH: "..script.Parent.Value.Value
end
    end
0
Nothing happens at all Snowskateer2 19 — 9y
0
What is meant to happen? neoG457 315 — 9y
0
fixed it anyway Snowskateer2 19 — 9y

1 answer

Log in to vote
0
Answered by 9 years ago
  1. i don't think using while wait() do is correct. You should put a true or false value or a value ><= so the loop goes on until the value changes.

  2. when you set a health value you don't need to put "" you just write the number. For example: OHealth.Value.Value = 4000 and not OHealth.Value.Value = "4000". Unless it's a text or a stringvalue.

  3. script.Parent.Parent.OHealth.Text = "OPPONENT'S HEALTH:""..script.Parent.Parent.OHealth.Value.Value.."" <---- Correct way of writing it

Ad

Answer this question