I'm trying to make a script that waits until a requirement is met, and then the command runs. For example, when a server collectively earns a certain amount of points, a message changes. I'm a beginner with scripting, and I feel that knowing how to do this will be useful. I've tried using if/elseif statements, although it never works properly.
local points = game.Workspace.Total.Value
while true do
wait (0.5)
if points > 299 then
script.Parent.Text = "Message #3"
end
elseif points > 199 then
script.Parent.Text = "Message #2"
end
elseif points > 99 then
script.Parent.Text = "Message #1"
end
end
In the example scenario, when the server reaches 100 points, a textbox changes revealing a message. And again when they reach 200, 300, and so on.
In the output, I'm being told I'm missing an "end" to close the "while true do", but no matter how I change up the indents in the code or the "end"s, it still doesn't seem to work.
I know this is completely wrong, but I can't find anything across the internet whatsoever. If anybody knows a solution to this or where I can find one, it would be greatly appreciated. Finally, if I'm breaking any rules without knowing it, I apologize, and I will fix that in my next post.
Thanks, Elliott

1 comment
There will be only one end. One for the
while true doloop and one for theifstatement. Note that you don't have to add more ends toelseifstatements because they are connected with theifstatement