Basically, I tried moving every part inside a Model by setting a part inside of it to its PrimaryPart, and tried changing its position with a script. I tried changing the part's Position to the Position of a part named "location" inside Workspace. Anyone know how to fix?
Here's the script:
local debounce = false script.Parent.Touched:Connect(function(part) local isHuman = part.Parent:FindFirstChild("Humanoid") -- Checks if a player has touched the part. if isHuman then if not debounce then debounce = true local clone = game.ServerStorage.car:Clone() -- makes a Clone of the model clone.Parent = workspace -- This works clone.mainPart.Position = workspace.location.Position -- the "mainPart" is the PrimaryPart of the model, and I tried changing its position to the position of a part named "location" inside Workspace. It changed the position correctly, but the other parts didnt change with it. wait(3) debounce = false end end end)
Use Model:SetPrimaryPartCFrame()
. It will set the PrimaryPart
to a certain CFrame
and move the rest of the model based on the PrimaryPart
's orientation and position.
local Model = Car:Clone() Model:SetPrimaryPartCFrame(CFrame.new(0,0,0)) Model.Parent = workspace
https://developer.roblox.com/api-reference/function/Model/SetPrimaryPartCFrame