How to make a route system

Hey so, I’ve been trying to crack out the code that is in SCR (Stepford county railway)
and how the track turns when you have a different route but im not sure.
So I tried

if StringValue = Route1 then
function onTouched(hit)

	game.Workspace.parta1.CanCollide = true
	game.Workspace.partb1.CanCollide = true
	game.Workspace.partc1.CanCollide = false


But it dosen’t work, it shows me a error even tho I put the stringvalue in the train.

1 Like

I think SCR moves parts of their tracks (like in real life with trains) so that the train moves into the correct track.

No like a sensor, with a stringvalue and if a train has this stringvalue it will move it to the correct place

so you would use:

local stringValue = part:FindFirstChildOfClass("StringValue") -- Finding anything which is a string value in an object called part.

if stringValue then
    --Rest of code here

Okay, I will try with this code now

The code didnt work, It didnt go the way I wanted

Like the train didnt go where I wanted it to go

1 Like