Model:SetPrimaryPartCFrame() not moving the player as the model move

Hi, I’m Bunnyh,

Since I started to make a sinking ship game, it seems that SetPrimaryPartCFrame don’t move the player as the model move. I want to make the player move as the ship move…

Without the player:

With the player:

I tried to use MoveTo()… but it didn’t worked. I’ve looked around on Roblox Wiki, DevForum, and searched any video, but they are a bit hard to understand to me.

-- Variables
local Titanic = workspace.Titanic -- Ship
local MainPart = Titanic.Main -- The Ship's PrimaryPart
local Detector = workspace.IcebergVisiblerDetection -- The part that finishes the first moving action

Titanic.PrimaryPart = MainPart
-- Main
while wait(5) do
	
	while true do
		
		Titanic:SetPrimaryPartCFrame(Titanic:GetPrimaryPartCFrame() * CFrame.new(0, 0, -0.5))
		
		wait(0.0001)
		
		if Titanic.PrimaryPart.CFrame == Detector.CFrame then
			
			print('Breaking Loop...')
			
			break
			
		end
		
	end
	
end

How I can solve this? Thanks :slightly_smiling_face:

Hey, so, you’re just setting the primary part CFrame of an object, which, doesn’t means the player will move with it, there are some open sources trains, you can take a look and see if it helps out :slight_smile:

2 Likes

can you tell me a function that can move with it too?

I didn’t saw the rest of your comment

@varjoy I’ll take a look on it

SetPrimaryPartCFrame() only moves the parts that are in the model. If you parent your character in the model it will work i think

1 Like

@20amir02 I’ll take a look on it too :slightly_smiling_face:

I don’t recommend you doing this, because, it will glitch, second, if a player dies, they wouldn’t respawn inside of the model, and the player movement would be kinda weird.

sorry for asking this stupid question, but how i can change speed?

TranslateBy

for i = 0, 100, 0.1 do

I see that a solution has already been posted so I don’t need to answer your question, but I’d like to say that that is a very detailed ship.

@ItsMeJakeZer the ship isn’t made by me

I’m not sure how this would affect walking and jumping, but you could move the players by the same amount that you move the ship.

Check this post:

I hope this helps!

1 Like

Hey, it’s been a while!
Why not using BodyMovers to move it? This would be make it: Smooth, and objects over it will move with it

try weld all parts together and then use BodyPosition and make the ship unanchored.
for more info