-
What do you want to achieve? I want to make when the train seat touched the part the speed will be reduce. The train seat located under the train so it can be touchable. I looked at the seat but its not broken and well welded.
-
What is the issue? When the train seat touche the part it happens nothing
-
What solutions have you tried so far? Yes but no solutions.
seat.Touched:Connect(function(child)
if (child.Name == "StationSensor") and (child.Parent.DoorLeft.Value == true) then
script.Parent.Parent.State.Throttle.Value = 0
script.Parent.Parent.State.Brake.Value = 10
wait(5)
script.Parent.Parent.State.Doorsystems.DoorL.Value = true
end
end)
Any helps is good.
Please.
4 Likes
Are Seat
or StationSensor
anchored?
StationSensor is anchored. The red block located on the rail is StationSensor and the seat is unanchored its welded with the train. Located on under the train.
What’s the class name of StationSensor?
Are you sure the Seat
reaches StationSensor
? The issue might be that the train lags and “jumps over” the sensor.
Maybe they could try using Region3 to detect when the Seat touched StationSensor if lag is the issue. I sometimes find that the Touch
event is unreliable when it comes to stuff like this.
robloxapp-20230724-1053133.wmv (2.9 MB)
The video sorry its not mp4.
Can you explain what is script.Parent.Parent
?
This is the train system I am using.
Can you try printing something if the condition has been passed?
For example,
if (child.Name == "StationSensor") and (child.Parent.DoorLeft.Value == true) then
print("true")
script.Parent.Parent.State.Throttle.Value = 0
script.Parent.Parent.State.Brake.Value = 10
wait(5)
script.Parent.Parent.State.Doorsystems.DoorL.Value = true
end
1 Like
Looks like its not printing. The child.Parent is not wrokign?
Try printing child.Parent
then.
Not in the if
condition, before it.
Hm. Looks like both are not working.
It appears like the Touched
event is not being triggered. Are you sure that the Seat
touches StationSensor
?
If it 100% does, then check if any of them have unchecked CanTouch
in the Properties. Check them back if they are off.
Are you using PhysicsService
by any chance?
I see that you don’t.
I think that the Touched
event is pretty unreliable. You’ll need Region3
in order to achieve it.
1 Like
No, it is not. You need to check the NetworkOwner
of the part. If it is different owner, it will not be reliable. Also make sure none of the assemblies are anchored. If it is they don’t touch.
1 Like
I manage to find a way to make something different.
Train System P2 - Creator Marketplace (roblox.com)
1 Like