Help, I'm trying to make a slot car connector, the problem I am having is trying to position the seat,,,, when it spawns the seat is still the same position as the old seat. Help???
local tool = script.Parent
local event = tool:WaitForChild("Signal2")
local function ReceiveSignal2(point)
local remotescreen = tool.Handle
local vehtxt = remotescreen.Text
if point.Parent.Name ~= "Piece1" then
vehtxt.Value = "Could not identify track. Either it is not the starting piece, or it is not a track."
wait(5)
vehtxt.Value = "Click on the starting piece of slot track."
else
local track = point.Parent
local car = tool.Slot
local trackname = point.Parent.Parent
vehtxt.Value = "Successfully got " .. trackname.Name
tool.Track.Value = track
if point.Name == "LLane" then
car.Value.PrimaryPart.Lane.Value = "L"
elseif point.Name == "RLane" then
car.Value.PrimaryPart.Lane.Value = "R"
end
car.Value.PrimaryPart.Track.Value = trackname
car.Value.PrimaryPart.CurrentRoad.Value = track
car.Value:MoveTo(point.MovePoint.Position)
wait(2)
car.Value.PrimaryPart.Anchored = true
local number = 0
for i, v in pairs(trackname.Controllers:GetChildren()) do
if v:IsA("VehicleSeat") then
number = number + 1
end
end
car.Value.Parent = trackname.Cars
local seatnumber = number
local newcontroller = trackname.Controllers.Control1:Clone()
newcontroller.Name = "Control" .. seatnumber + 1
local oldcontrollernumber = seatnumber - 1
if oldcontrollernumber == 0 then
oldcontrollernumber = 1
end
--What I am having problems with
local offsetToChar = newcontroller.CFrame:PointToObjectSpace(trackname.Controllers["Control" .. oldcontrollernumber].Position)
newcontroller.Position = newcontroller.CFrame:PointToWorldSpace(offsetToChar + Vector3.new(-3, 0, 0))
newcontroller.Car.Value = car.Value
newcontroller.Parent = trackname.Controllers
wait(1)
vehtxt.Value = ""
end
end
event.OnServerEvent:Connect(function(player, mouseEvent)
print(player, mouseEvent)
local mouse = mouseEvent
ReceiveSignal2(mouse)
end)

1 comment
If i understood your question correctly, i think i know what to do