Hey, I’m currently working on a system that detects the position of a block it touches, but I just can’t figure out how to avoid this!
The issue is, when sizing the sensor, it always resizes itself in the middle, and not connected to the car’s side. Anyone know how to resize the sensor to both be in the position of the thing it touches, and connected to the car?
Video:
Block I’m trying to resize is on the left side of the car
Script:
local Base = script.Parent.Base
local Find = script.Parent.Find
Find.Touched:Connect(function(hit)
Find.Size = Vector3.new(hit.Position.X - Find.Size.X ,Find.Size.Y,Find.Size.Z)
end)
PS: This is my first help forum. If I did not do anything right in the formatting, PLEASE tell me!
local Base = script.Parent.Base
local Find = script.Parent.Find
Find.Touched:Connect(function(hit)
Find.Position = hit.Position
Find.Size = Vector3.new(hit.Position.X - Find.Size.X ,Find.Size.Y,Find.Size.Z)
end)
That would be if you want it to be resized on the brick that it touched.
If you want to make it move sideways toward the vehicle, then maybe try this:
When resizing it (for example by 1 stud) move it by 1 stud on the same axis.
I know what is making that mistake, but I’m trying to figure out how to fix it. All I can think of is moving it along an axis so it meets up with the vehicle, but I’m not exactly sure how you would do that.