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

This only changes the text one time but it should change it twice, can you help me?

This script only changes the text once, even when the value changes it stays the same but the first time when the game starts it does change, can you help me fix this?

while true do script.Parent.Text = script.Parent.Parent.Parent.Value.Value end

2 answers

✓ Accepted answer
while wait(0.5) do -- with while true do it will change so fast so you cant see first text, now it is waiting 0.5 second 
	script.Parent.Text = script.Parent.Parent.Parent.Value.Value
end

First, to fix your code block, edit your question and click on the lua symbol at the top left corner, then put your code inside the tildes

Secondly, what are you trying to do?

And also you need to add a

wait()

in the script or else the loop will run 50 times a second and crash Roblox Studio.

And if you want the text to change twice, you can't do a while loop, you need a for loop. Example:

for i = 1, 2 do -- the 'i' can be whatever you want, it is just a varible.
-- Do stuff
end

But to finally answer your question, the reason the text isn't changing is because you aren't changing the text. You are just setting it to be the exact same value. You need to change something to the value and then set it to be the text.

If the value you're using is a number value then just do this:

for i = 1, 2 do

script.Parent.Text = script.Parent.Parent.Parent.Value.Value
script.Parent.Parent.Parent.Value.Value = script.Parent.Parent.Parent.Value.Value + 1
end

Or if it's something else like a string value then you can do this:

for i = 1, 2 do

script.Parent.Text = script.Parent.Parent.Parent.Value.Value
script.Parent.Parent.Parent.Value.Value = "WhateverYouWant"
end

Sorry for such a long answer, but you get the idea.

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