I want any model certain models that meet the if requirements to move to a certain position once it touches the “MovePart”
the script doesn’t work, I’m not saying the script is the problem, I’m new to scripting so I don’t even know if I can’t do :MoveTo() like this or I made a mistake:
local MovePart = script.Parent
MovePart.Touched:Connect(function(hit)
if hit.Name == ““TouchMovePart”” then
hit.Parent.Parent.Parent:MoveTo(Vector3.new(1,1,1))
end
end)
I think the problem is somewhere in line 4 but idk what
Basically, there is a part in front of the bonnet of the bonnet of the car called ““TouchMovePart””, if that part is the one that touches the “MovePart”, then its parent which is “Car”, and Cars parent which is “Body”, and bodys parnet which is the car, should move to the certain new Vector3? Right?
I’m pretty sure if a human is currently sitting in the car while the human is moved, the car will go along with it. So, @liamazu1000 should be right in this regard.
Ok, thanks all for the info, but how would I go about moving the certain players that is in the car that is supposed to be moved, I mean, how would I address that specific person, and also, would it be a smooth transition or a teleport transition
Model:MoveTo() works, but is not as good as Model:SetPrimaryPartCFrame(). The difference between Model:MoveTo() and Model:SetPrimaryPartCFrame() is that Model:MoveTo() teleports the model, but not always to the exact position, if there’s a blockage or whatnot within the perimeters of the model, it will be teleported above the blockage, and uses Vector3.
Model:SetPrimaryPartCFrame() requires a model PrimaryPart and knowledge of how to use CFrames, but is effective at teleporting to exact positions.
To answer your question, I’m not sure what’s exactly wrong, because your code seems perfectly fine to me. My suggestion is to check the output logs for any errors made by this script.
Thanks for the info, but do you by any chance know how to reference the humanoid driving the car? And is Humanoid:MoveTo() smooth like tweening? Or is it like teleport like SetPrimaryPartCFrame() and MoveTo()?
Humanoid:MoveTo() does not work in your case. It makes the character walk to the given Vector3. Some people are spreading misinformation, as Model | Documentation - Roblox Creator Hub exists. The only person who was correct about Model:MoveTo() existing or not was @ItsMeFelixAccept.
Does the actual script has 2 double-quotes or was it typed wrong?
I haven’t really worked with cars so I’m not sure how to make a fully functional one, but try this:
local MovePart = script.Parent
local Model = MovePart.Parent.Parent
MovePart.Touched:Connect(function(hit)
if hit.Name == "TouchMovePart" then
Model:SetPrimaryPartCFrame(CFrame.new(Model:GetPrimaryPartCFrame().LookVector * 5))
end
end)
Omds thank you, I didnt notice. It teleports the car but it also kicks the driver out, I understand you’re not a car guy so you may not know. If you don’t know, that’s fine! I appreciate your help.