What would I use to move a model which is cloned 10 studs infront of the humanoidrootpart? This is what I tried.
script.Parent.MouseButton1Click:Connect(function()
local thatgreencar = game.ReplicatedStorage.GreenSUV
local player = game.Players.LocalPlayer
local character = game.Players.LocalPlayer.Character
local humanoidRootPart = character:WaitForChild("HumanoidRootPart")
local thatgreencarClone = thatgreencar:Clone()
thatgreencarClone.Parent = workspace
thatgreencarClone:SetPrimaryPartCFrame(humanoidRootPart.Position)
end)
You need to make a CFrame that is 10 studs in front of the player. A way to do this is by multiplying the lookVector, which will move it in the direction that the brick is facing. This will work if the brick is facing the same direction as the player.
There is a function called Model:SetPrimaryPartCFrame. It can be used to set the CFrame of the primary part, and all other parts in the model will move with the primary part. I think you could do it like this: