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

Are you able to get objects children through a value?

I am trying to make a live update board which changes to the last vehicle that passed through the sensor. Currently it saves to the value correctly but it does not know what is in the value's children. I need it to memorise the vehicle so when the destination on the vehicle updates, so does the board. Is there a way around this or can it not be done. Here is the code I got so far:

value = script.Parent.Value
gui = script.Parent.SurfaceGui.TextBox

function touched(eeeee)
	if eeeee.Name == 'TRAINTRIGGER' then
		value.Value = eeeee
	end
end

script.Parent.Touched:Connect(touched)

while true do
	gui.Text = script.Parent.Value.Value.destination.Value
	wait()
end

4 comments

0

Yes by looping through it using a for loop.

0

How would you be able to do this?

0

Can you explain your question??

0

Basically, a train approaches a station and hits the sensor. It then displays the destination (traintrigger.destination.Value) on the board (gui). I need it to memorise the train so that if it train changes destination, such as in a terminus, the board will update too.

1 answer

Jesse's suggestion of putting a for loop worked when I figured out how. Thanks to him.

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