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

Is there is any way to fix this problem?

So I wrote a code, and I tested it.

script.Parent.Frame.TextButton.MouseButton1Click:connect(function()
	if script.Parent.Frame.TextLabel.Text == "Hello! I'm mine248 and I'll be teaching you how to operate this train." then
		script.Parent.Frame.TextLabel.Text = "Press the up key or W to go forwards."
	elseif script.Parent.Frame.TextLabel.Text == "Press the up key or W key to go forwards." then
		script.Parent.Frame.TextLabel.Text = "Press the down key or S key to go forwards."
	elseif script.Parent.Frame.TextLabel.Text == "Press the down key or S key to go forwards." then
		script.Parent.Frame.TextLabel.Text = "Go open the door, on the side the platform is at (a big peice of block)."
	elseif script.Parent.Frame.TextLabel.Text == "Go open the door, on the side the platform is at (a big peice of block)." then
		script.Parent.Frame.TextLabel.Text = "Then wait until the timer counts to 1."
	end
end)

I t would work from lines 1-3, then fail on the other. Is there a error that did it?

1 comment

0

Any output?

1 answer

✓ Accepted answer

You have different strings on line 3 and 4. To avoid this, use a variable or table:

local instructions = {
	"Hello! I'm mine248 and I'll be teaching you how to operate this train.",
	"Press the up key or W to go forwards.",
	--etc
}
local step = 1
script.Parent.Frame.TextButton.MouseButton1Click:connect(function()
	script.Parent.Frame.TextLabel.Text = instructions[step]	
	step = (step % #instructions) + 1
end

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