I am working on a GUI where you can spawn vehicles, I am trying to make it so that when you spawn a vehicle you get teleported to it, the whole thing works, the vehicle spawns, the player gets teleported but here’s the problem. I have several places for a vehicle to get spawned, There are 4 for each type of vehicle, I added “sensors” which use Touch and TouchEnded to see if a vehicle is touching the sensor, which would then change a value. The problem is the sensors don’t detect the vehicle sometimes which makes it really unreliable. If anyone could help please do. Below is the script for the sensors.
script.Parent.Sensor.Touched:Connect(function()
script.Parent.SensorVal.Value = true
end)
script.Parent.Sensor.TouchEnded:Connect(function()
script.Parent.SensorVal.Value = false
end)
This is only one of them but basically how all of them are
Probably not related to the OP but
TouchEnded
can work in a lot of wonky & unreliable results, as it’ll fire every time in addition with the Touched
event as well, I’d recommend using Region3
, or Magnitude
instead for getting a portion of the world region (Or area) to set the SensorVal
object
1 Like
I don’t see how I would make use of the distance between the part and the vehicle for a sensor, although why would I use Region3 for this?
Detection via touch is a really outdated method, I suggest you check out the new Prompt Feature.
yes a part can enable a prompt and has the ability to use a keyboard 
Again, Region3
can be used to obtain a 3d region provided you have MinSize
& MaxSize
values
You can calculate given both of these values using the workspace:FindPartsInRegion3
function & check if the Vehicle is touching the part or not
If it is, set its SensorValue.Value
to true
More info here: