Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I move my roblox Model using CFrame and allow it to collide without going on top of the map?

My model moves to the desired position, but afterwards it ends up on top of the map. I use:

wait(5)
game.Workspace.Tom:MoveTo(Vector3.new(198.99, 0.809, -161.23))

How do I move my model to a position and make it able to collide with parts around this map? I was unable to find any other solutions; I have tried:

wait(5)
Tom.CFrame = CFrame.new(-31.35, 0.5, 5.1)

but of course, CFrame isn't part of a model. Someone please help, thank you

-iInexorabilis

1 answer

✓ Accepted answer

A model has a property called 'PrimaryPart'. If you set a Primary for the model, you can use 'SetPrimaryPartCFrame' command built by roblox. Here is an example:

local model = workspace.Model
model.PrimaryPart = model.Primary -- name of the part is Primary

model:SetPrimaryPartCFrame(CFrame.new(0,1,0)) -- Center of baseplate

1 comment

0

Thank you, this worked perfectly.

This discussion is preserved as it was. New answers, comments, and votes are closed.