I have a wheelchair which players can sit on. This wheelchair is a tool that you can equip and move around. Someone else can use a ProximityPrompt to sit on it. But there’s a problem.
There is a VehicleSeat in the wheelchair and I use :Sit() to force the player into the seat. Later, they can jump out to leave the seat. But when they jump out, they get “flung” across the map.
Sometimes, they also jump really high, other times, it works just fine. In Studio it works great, but as soon as I join the real game, whenever you jump out of the seat, you get flung.
Here’s my seat exiting code:
seat.Changed:Connect(function()
if seat.Occupant == nil then
if playerSitting then
local char = playerSitting.Character
local hrp = char:FindFirstChild("HumanoidRootPart")
local hum = char:FindFirstChild("Humanoid")
hum.Sit = false
game:GetService("RunService").Heartbeat:Wait()
hrp.AssemblyLinearVelocity = Vector3.zero
end
prompt.Enabled = true
playerSitting = nil
end
end)
Any and all help is greatly appreciated. If you have any questions, don’t hesitate to ask.
Is there any part of the script that parents the vehicle or vehicle seat to the player… this is what causes the fling, and when i removed this from my vehicle scripts they all stopped flinging.
Edit: does the player keep getting flung even when they try to go back to the seat?
To anyone who’s interested, I managed to solve this issue. Although it’s a bit hacky, it works perfectly fine for my purposes. Just use a RunService.Stepped loop that repeats around 20 times, in that loop set the HRP position to the seat’s position and set the HRP velocity to zero.