Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why is this not working?

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

3 comments

0

Nothing happens at all

0

What is meant to happen?

0

fixed it anyway

1 answer

  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

This discussion is preserved as it was. New answers, comments, and votes are closed.