so im creating a custom suspension system for a car. everything works on the server but as soon as the player gets in the driver seat the body gyro and position stop doing anything
Post your script so we can see how you are doing it.
When a player sits on a VehicleSeat they automatically get network ownership of the car. I think if you have passenger seats you may have to disable their occupant’s network ownership (I could be wrong).
From your description it sounds like your script is all local, which doesn’t control the server aspects.
in the video before i sit in the car it was being controlled by the server
as soon as the player sits in the seat it gives the player network ownership and server stops controlling the car
im using a driver seat so i dont have to make my own input system
this is ran when the player sits in the seat:
(server)
function component:giveNetworkOwner(player, model)
if model == nil then
model = self.model
end
for i, v in pairs(model:GetDescendants()) do
if v:IsA("BasePart") or v:IsA("MeshPart") or v:IsA("UnionOperation") or v:IsA("VehicleSeat") or v:IsA("Seat") then
if v:CanSetNetworkOwnership() then
if v:GetNetworkOwner() == nil then
v:SetNetworkOwner(player)
end
end
end
end
end
self.driverSeat:Sit(player.Character.Humanoid)
self.carController:disable()
self:giveNetworkOwner(player)
setMass(player.Character, true)
local client = driverClient:Clone()
client.Model.Value = self.model
client.Parent = player.Character
and this is ran when the driverClient scripts runs
local carController = CarController.new(model, setting)
carController:start()
CarController.new just initialize all the components required for the car to work
the body movers (gyro/position)
set up the wheels’ throttle vector force and friction vector force
CarController:start starts the main loop to calculate everything
CarConroller:disable sets the max force/torque of the body movers to 0 and disables the vector forces and disconnects the main loop (basically destroying but still keeping them there)
both of these functions are the same client and server
I guess part of my question is why do you need to set the ownership of the car assembly? Roblox automatically sets the vehicleseat and everything attached to it to the Occupant of the VehicleSeat when they sit.
Why do you have 2 BodyGyros and 2 BodyPositions in the car chassis? An issue could be if your script searches for a BodyGyro in the chassis and sets it’s parameters, and the other script searches for a BodyGyro but picks the other one the parameters may not be properly read or changed.
Another thing is that BodyGyro and BodyPosition have been deprecated. They still work, but if Roblox doesn’t support them anymore you may get issues in the future.
it doesnt give the player network ownership automatically plus stuff werent replicating so i always do it
there is 2 because one is the server and one is the client, the server is just disabled. i dont want to constantly destroy and recreate it when people keep leaving and getting in the car, so its easier to just disable it
the script doesnt search for the body mover because it creates it
im using body position and gyro because they are easier to control over the newer version of align orientation and position, plus i tried switching to the new ones and nothing worked. these body movers work just fine so why switch