I’m trying to script a train tracking screen. The purpose of it is to show the time of when a specific train will arrive to the given station the user is in. In order for information to appear on the screen, the train must touch a sensor that is placed in the tracks.
The script below functions as the following: If script.Parent.Parent.TwoMinAway.ValueOne.Value equals touch.Parent.Name then it will changed the time on the train tracking screen to “1 Min” but if script.Parent.Parent.TwoMinAway.ValueOne.Value doesn’t equal touch.Parent.Name then it will check the second IntValue to see if they match.
script.Parent.Touched:connect(function(touch)
function onTouchedTwo(touchtwo)
if touch.BrickColor == BrickColor.Black() then
if touchtwo.BrickColor == BrickColor.Red () then
if script.Parent.Parent.TwoMinAway.ValueOne.Value == touch.Parent.Name then
script.Parent.Parent.SurfaceGui.Frame.RouteOne.Text = touch.Name
script.Parent.Parent.SurfaceGui.Frame.TimeOne.Text = "1 Min"
-- print(touch.Parent.Name)
script.Parent.Parent.SurfaceGui.Frame.DestOne.Text = touchtwo.Name
elseif script.Parent.Parent.TwoMinAway.ValueTwo.Value == touch.Parent.Name then
script.Parent.Parent.SurfaceGui.Frame.RouteTwo.Text = touch.Name
script.Parent.Parent.SurfaceGui.Frame.TimeTwo.Text = "1 Min"
script.Parent.Parent.SurfaceGui.Frame.DestTwo.Text = touchtwo.Name
end
end
end
end
script.Parent.Touched:connect(onTouchedTwo)
end)
Issue: Both script.Parent.Parent.TwoMinAway.ValueOne.Value and touch.Parent.Name have the same values but the GUI isn’t changing to “1 Min”, how can this be fixed?
