There are a few things we have to fix in your script.
First off, at line 2:
local p = game.Workspace.bo.SurfaceGui.TextBox.Text
What's happening here is that p is now a string, and this string will be what's written in the
Text property. If you directly change the value of p to, for example:
p = "Step right up!"
What will happen is that it will change what the value of p is, and it will not change what the sign is saying. To change what the sign is saying, you have to do this:
local p = game.Workspace.bo.SurfaceGui.TextBox
p.Text = "Step right up!"
Another thing is that you don't change values of variables and properties between () (Atleast from my knowledge).
Now, to the while loop:
while x == 1 do
p = ("Step right up!")
wait(3)
p = ("Don't be shy, now!")
wait(3)
p = ("Step on that green plate there, and be amazed!")
wait(3)
end
What's happening here is that currently, x is equal to 1 and so, your code will start running the while loop. But now, your code is stuck in the while loop, and it will not run anything below it.
So what you can do is to put the while loop in a different thread, and so the code will run the while loop and the other stuff below it.
spawn(function()
while x == 1 do
p = ("Step right up!")
wait(3)
p = ("Don't be shy, now!")
wait(3)
p = ("Step on that green plate there, and be amazed!")
wait(3)
end
end)
Another problem that rises with the while loop is that the loop will not instantly stop if x is not equal to 1.
So for example, in the sign it's showing "Don't be shy now!". When that happens, the player presses the button and x is not equal to 1 anymore. But that doesn't mean the while loop will stop working, it will still wait those 3 seconds, show "Step on that green plate there, and be amazed!" wait another 3 seconds and then finally the while loop will stop working.
So to fix that problem I suggest doing:
spawn(function()
local messages = {
"Step right up!",
"Don't be shy, now!",
"Step on that green plate there, and be amazed!"
}
while x == 1 do
for i = 1, #messages do
if x ~= 1 then return end
p.Text = messages[i]
wait(3)
end
end
end)
I hope I solved your problem and helped.