Hello developers!
I’m working on an RPG styled game and me I’m wondering how we could make a boat model move. To be a little more in-depth, we have two destinations for this, one is obviously a map location players can visit, the second location is an island quite far away. Our goal is to not just teleport the player because we want to push ourselves and learn more. So, with this being said we’re hoping the final product will be a boat that moves that all players can see. Also, we are using terrain water, not sure if that impacts anything but figured I’d add it in.
Thank you if you are able to help! It means a lot to me! I’m a very visual person so, if possible at all, please provide visuals or articles from the roblox wiki!
I think the best way to do this is either by tweening (TweenService) the Primary Part or welding every part together and then tweening the CFrame of the part everything is welded to.
If it’s a boat that isn’t meant to be drivable and follows a set path, I’d consider the pros of anchoring it, cframing it along a path, and teleporting players along it. Not the best performance wise, but you can forget about problems with physics and stuff.
I can tell you how I did it. In my game, there is a boat you can sit in and after the intermission the boat will move to the chosen map. I just used tweenservice for invisible “main” part + everything is welded to that main part. Here is my code:
sail.Event:Connect(function()
if sailing == false then
sailing = true
local goal = {}
goal.CFrame = CFrame.new(1019, 21.636, 51)
local tweenInfo = TweenInfo.new(6)
local tween = TweenService:Create(boat2PrimaryPart, tweenInfo, goal)
tween:Play()
tween.Completed:Wait()
end
end)