Making a boat model move locally?

I’ve been making a boat that needs to be moved locally for an intro to a game I am making, and when I try to move it with body movers locally, nothing happens. I have a script in ServerScriptService that moves the boat to the workspace, I would have done this locally, but that caused some issues of its own.

When I try to do this code to move it, nothing happens to the boat, does anyone know what’s wrong? Also, let me know if I need to provide any more information.

Edit: I also have a weld script that welds the model on the server side before the boat is moved by the client.

local cloneBoat = workspace:WaitForChild("BoatBeginning")

local BodyPos = Instance.new("BodyPosition")
local BodyGyro = Instance.new("BodyGyro")

BodyGyro.CFrame = CFrame.Angles(0,0,0)
BodyGyro.MaxTorque = Vector3.new(1000000,1000000,1000000)


BodyPos.Position = Vector3.new(-280.36, -9.511, 505.135)
BodyPos.MaxForce = Vector3.new(1000000,1000000,1000000)
BodyPos.P = 100

BodyGyro.Parent = cloneBoat.TheBase
BodyPos.Parent = cloneBoat.TheBase
2 Likes

ServerScriptService is a server sided container that cannot be accessed in any way by the client—that is to say, scripts within this object will not replicate to the client, and thus cannot make any local changes. Use the StarterPlayerScripts instead but also make sure that it is being run from a LocalScript. As far as general functionality goes, for this to truly be local you are going to want to place your boat or any other objects within the player’s CurrentCamera.

2 Likes

My local scripts have nothing to do with ServerScriptService, they are run in the player. The ServerScriptService only moves the boat on the server side, and then I try to control it with the client. And I’m not trying to make the entire boat local, I just wanna control it locally. Also are you sure that’s the only way to make it local? I’m pretty sure you can just move things to workspace with a local script and that would be a local part.

Oops, I misread your post. Your problem is that the client does not have Network Ownership over the boat once it is moved to workspace. I would first suggest that the client spawn the boat from a RemoteEvent that then prompts the server to spawn the client’s boat and authorize any changes that the player would like to send to it.

As far as local parts go, if you mean parts which are only visible to one client; yes this is the only way I know. If you mean whether or not these parts can be controlled locally from the client, then you’re referring to the client-server model and should look into how replication works.

1 Like

The thing is that I don’t want the boat moving to be seen by the server, it’s for a beginning cut-scene and I need the entire thing to be local due to other players going through it at the same time.

In that case just keep the boat in ReplicatedStorage and clone it over to the player’s camera using a local script when they load in. This will make the boat only visible on the client.

2 Likes

That was my original thought, but when I moved it over, it would just move to a random spot that wasn’t where it was supposed to be. I think it has something to do with my welds, which were local, but I couldn’t figure out what the issue was so I just moved it over on the server and then controlled with the client.

That’s most likely the problem—that is a pretty broad topic to get into though. Best suggestion I can give you is to make sure you create your part welds before you parent the boat to the player’s Camera. Create a root part for the model and weld all of the parts to it and then set its PrimaryPartCFrame to an area in front of the Camera or wherever you would like to put it.

3 Likes