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

Moving a model doesn't work, any alternatives??

I have a model in server storage that I want to clone, then move. I have tried putting the model inside of a part, and I can't union it like I did with some other things because there is a script. How can I move the model as a whole?

P.S. I need to move it because I'm making a randomly-generated game, and I can't just put one in each specific coordinate.

1 comment

0

if you want an instantaneous move, just use SetPrimaryPartCFrame(cframe)/MoveTo(pos), however, if you want to move it slowly , you can use one of three methods, 1. Tweening(with Colbert2677's tutorial), 2. SetPriamryPartCFrame w/ lerp, 3. TranslateBy(offset)

1 answer

Here is a tiny script untested that will probably work, it just assigns the model, gets the mouse hit position then moves the model there...

Localscript in startergui...

repeat wait() until game.Players.LocalPlayer
local p = game.Players.LocalPlayer
local modelToBeMoved = game.ReplicatedStorage.Model
local mouse = p:GetMouse()
while true do wait()
	modelToBeMoved:SetPrimaryPartCFrame(CFrame.new(mouse.Hit.p))
end

Make sure the model's property "PrimaryPart" is set, this is because we used SetPrimaryPartCFrame().

Make sure it is a model.

Make sure to accept this answer if it works xd

Also there is a much much more advanced version of this in the blog section of this website.

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