How do I move a model back to its original position on respawn?

Hey, I’m currently creating some speedboats to add to my cafe game, and I added a chat command that removes all the boats in the game and respawns them after some time. I’ve successfully created this, however the boats are models and I’m wondering how to set the boat CFrames back to the original spawn position after respawn.

My current code:

local GroupId = 10946784
local AllowedRank = 15
local nil1 = game.Workspace.Boat
local nil2 = game.Workspace.Boat2

game.Players.PlayerAdded:Connect(function(Player)
	Player.Chatted:Connect(function(chat)
		if chat ==":removeboats" and Player:GetRankInGroup(GroupId) >= AllowedRank then
			nil1.Parent = nil
			nil2.Parent = nil
			wait(20)
			nil1.Parent = game.Workspace
			nil2.Parent = game.Workspace
		else

		end
	end)
end)

Any help would be greatly appreciated.

2 Likes

You will need to save the boat position and then move it back.

local GroupId = 10946784
local AllowedRank = 15
local nil1 = game.Workspace.Boat
local nil2 = game.Workspace.Boat2

local boat1OriginPos = Vector3.new(x,y,z)
local boat2OriginPos = Vector3.new(x,y,z)

game.Players.PlayerAdded:Connect(function(Player)
	Player.Chatted:Connect(function(chat)
		if chat ==":removeboats" and Player:GetRankInGroup(GroupId) >= AllowedRank then
			nil1.Parent = nil
			nil2.Parent = nil
			wait(20)
            nil1.Position = boat1OriginPos 
            nil2.Position = boat2OriginPos
			nil1.Parent = game.Workspace
			nil2.Parent = game.Workspace
		else

		end
	end)
end)
2 Likes

This seems to work up until Lines 15 and 16. It tells me that Position is not a valid member of the model. I’m unsure what to change this to.

Can anyone please help me with fixing this minor issue, I really need this

1 Like

Sorry for late reply, for this you should connect all the model parts together by using Weld, you can use Easy Weld tool for this. After that, determine the base part of the model and change it CFrame because changing to Position would break the weld. If you need an example, ask me.

The parts are currently welded.

Now, for the OriginPos, change it to CFrame.new(x,y,z), after that down below, you have to find the BasePart of the model, for easier, do BoatModel.PrimaryPart.CFrame = OriginPos.