I’m trying to make a boat/ship type pvp experience, but I’ve encountered an
issue about seat parts, that I can’t seem to find a fix for. When the player sits in a chair, the orientation/cframe also changes to match the player’s root cframe. (As well as the entire boat/ship)
I’ve tried setting the seat’s network ownership to the server, tried making my own seat system, and messed with the physicsservice of the seat. But unfortunately, it either just sinks the boat or not work at all.
Here is a code snippet of my serverscript responsible for unanchoring objects:
local NewPhysicalProperties = PhysicalProperties.new(0.5)
local NewPhysicalProperties_2 = PhysicalProperties.new(0)
for _, v in ipairs(BlocksFiles:GetDescendants()) do
if v:IsA("BasePart") then
v.Anchored = false
if v.Parent:IsA("Model") then
v.CustomPhysicalProperties = NewPhysicalProperties
else
v.Massless = true
v.CustomPhysicalProperties = NewPhysicalProperties_2
end
end
end
for _, v in ipairs(BlocksFiles:GetDescendants()) do
if v:IsA("BasePart") then
v:SetNetworkOwner(nil)
end
end
Here is a clone of the seat to replicate the bug: seatrepl.rbxm (35.6 KB)
Here is a clip of the bug in action:
Is there any way to prevent this type of bug? Thank youu in advance
I believe this is a result of your boat having a very small mass due to making the parts massless. Try making them not massless and see if that fixes it
Did I do it correctly? Did I set the wrong property…?
local NewPhysicalProperties = PhysicalProperties.new(0.5)
local NewPhysicalProperties_2 = PhysicalProperties.new(0)
for _, v in ipairs(BlocksFiles:GetDescendants()) do
if v:IsA("BasePart") then
v.Anchored = false
if v.Parent:IsA("Model") then
v.CustomPhysicalProperties = NewPhysicalProperties
else
--v.Massless = true
v.CustomPhysicalProperties = NewPhysicalProperties
end
end
end
for _, v in ipairs(BlocksFiles:GetDescendants()) do
if v:IsA("BasePart") then
v:SetNetworkOwner(nil)
end
end
Hmmm that’s odd. Everything looks right so idk why it would fling like that. Another idea you could try is changing the players rotation cframe to match the orientation of the seat when they touch it
local Seat = script.Parent
local scf = script:WaitForChild("SCF", math.huge)
local PrevCF = scf.CFrame
game:GetService("RunService").Heartbeat:Connect(function()
PrevCF = scf.CFrame
for _, v in ipairs(script.Parent.Parent.Parent:GetDescendants()) do
if v:IsA("BasePart") then
v:SetNetworkOwner(nil)
end
end
end)
Seat:GetPropertyChangedSignal("Occupant"):Connect(function()
if Seat.Occupant and Seat.Occupant.Parent:FindFirstChild("HumanoidRootPart") then
local Root = Seat.Occupant.Parent:FindFirstChild("HumanoidRootPart")
Root.CFrame = PrevCF
end
end)
Im sure, there’s a more efficient way than what I made. But it works perfectly.
(I made a simulation so I don’t have to deal with the round system I made everytime)