CFrame Collisions

Hey there,

I was working on a Golfcart which would be moved via Model:SetPrimaryPartCFrame, however, this doesn’t allow the Parts in the Model to collide when they hit another part. I would like it to move via CFrame but be able to have it collide with other parts sit’s touching or that it hits. Below is attached a photo of what I mean:

The exact way I move my cart is with something like this: Model:SetPrimaryPartCFrame(Model.PrimaryPart.CFrame * CFrame.new(0, 0, Frame))

Thanks,
Iukyns

Using CFrame to move the vehicle is not a very efficient way. It will ignore any other part. I recommend looking into constraints and using hinge constraints to make a golf cart as they can be used as motors. Here is a example tutorial : Making a Car: Joints - YouTube

However, how would I move the car with hinges without a Vehicle Seat? Could you provide example code?

Well you will need to find out if the person is pressing forward or backward and is inside the golf cart which you can use with userinputservice. The vehicleseat is very useful because it detects if the person is pressing forward or backward with Throttle and Steer in the properties but if you don’t want the vehicle seat for any reason here is some code :

local user_input_service = game:GetService(“UserInputService”)
local player = game.Players.LocalPlayer
local vehicle_seat = – Vehicle Seat Model
local value = nil

user_input_service.InputBegan:Connect(function(Key)
if Key.KeyCode == Enum.KeyCode.W then
if player.Character.Humanoid.Sit == true then
if value == “player is in seat” then
– Move the car forward and replicate it to server side
end
end
elseif Key.KeyCode == Enum.KeyCode.S then
if player.Character.Humanoid.Sit == true then
if value == “player is in seat” then
– Move the car back and replicate it to server side
end
end
end
end)

vehicle_seat.PrimaryPart.Touched:Connect(function(part)
if part.Parent.Name == player.Name then
value = “player is in seat”
end
end)

vehicle_seat.PrimaryPart.TouchEnded:Connect(function(part)
if part.Parent.Name == player.Name then
value = nil
end
end)

vehicle_seat.Parent = workspace

I understand that, I just want to know how I would make the cart move forward/back.

Oh, well you’d need to make a hingeconstraint on both back wheels, change the right and left wheel ActulatorType to motor and set the right wheel AngularVelocity to 10 and the left wheel AngularVelocity to -10. This will make the car move forward I think. If you change the right wheel to -10 and left wheel to 10 then it will move back. Here is a tutorial that might help : Building a Ferris Wheel | Roblox Creator Documentation

The first reply I added a link which should help you understand how to make vehicles move if you also watch Making A Car : VehicleSeat by roblox