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

Cen you help me ?

while true do
wait(0.05)
 
if script.Parent.Parent.Control.Value == 0.03 then
while true do
script.Parent.a.SurfaceGui.TextLabel.Text = "This train Terminus here."
script.Parent.b.SurfaceGui.TextLabel.Text = "You can exit this train"
wait(5)
script.Parent.a.SurfaceGui.TextLabel.Text = "or stay here"
script.Parent.b.SurfaceGui.TextLabel.Text = ""
wait(5)
 
if script.Parent.Parent.Control.Value == 0.05 then
script.Parent.a.SurfaceGui.TextLabel.Text = "Ad.test"
script.Parent.b.SurfaceGui.TextLabel.Text = "Ad.test"
 
 
end
end
end
end

*This script not is full staple Wrong:The script do no to anything! Value:Number Value l need a fixed script

3 comments

0

what does "a" and "b" equal ??

0

'a' and 'b' are not varialbes in this case, they are members of 'script.Parent'.

0

Using my code, what output errors are you getting?

1 answer

It looks to me that your ends are not placed properly. Also, using the while true do loop on the inside of the if statement is incorrect. To avoid the problem I think you're trying to avoid, try using elseif statements in place of every if statement after the first. Also, try tabbing the code, so you can see the logic more clearly:

local a = script.Parent.a.SurfaceGui.TextLabel
local b = script.Parent.b.SurfaceGui.TextLabel
local Control = script.Parent.Parent.Control
while true do
	wait(.05)
	
	if Control.Value == 0.03 then
		a.Text = "This train Terminus here." --"terminates" is the word you're looking for here.
		b.Text = "You can exit this train"
		wait(5)
		a.Text = "or stay here"
		b.Text = ""
		wait(5)
	--Note that there is no `end` here. The `elseif` does not get an end, only the `if`, but `elseif`s must be places within `if` statements.
	elseif Control.Value == 0.05 then
		script.Parent.a.SurfaceGui.TextLabel.Text = "Ad.test"
		script.Parent.b.SurfaceGui.TextLabel.Text = "Ad.test"
	end
end

1 comment

0

Bad,Keep get wrong

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