I made a mario kart model and wanted to make it driveable, which I knew from the start it wasn’t going to be easy. I followed Crazyman32’s guide on how to rig a car (How to Rig a Car) and i’ve made a few adjustments to small things like speed and stuff like that. no super big changes - except maybe that my model is made up of roughly 40 MeshParts. I managed to rig, weld, and sort everything into proper collision groups correctly and it seems to be working properly. except this keeps happening.
https://gyazo.com/1a9dcd06e49a26399f6b6f68206c4697
(my friend testing it)
at random times when i hop in the kart, something bugs out in the OccupantChanged function in the CarHandler script and some wheels bounce into the air. I know it has something to do with the physics messing up but i can’t seem to figure out what exactly. If you notice in the ouput, “start client” is when I get in the seat and “stop client” is when i hop out.
which means it only randomly “index nil with character” i’ve been fighting with this thing for almost 2 days, and its driving me crazy. Anyone have any idea what could possibily be going on?
here’s the lines where it messes up:
local function OccupantChanged()
if (seat.Occupant) then return end
if (occupiedPlayer.Character) then
SetCharacterCollide(occupiedPlayer.Character, true)
end
if (occupiedClientScript.Parent) then
occupiedClientScript.Stop.Value = true
local client = occupiedClientScript
delay(3, function()
client:Destroy()
end)
end
car.PrimaryPart:SetNetworkOwnershipAuto()
occupiedPlayer = nil
occupiedClientScript = nil
Cooldown(2)
end
body.Touched:Connect(BodyTouched)
seat:GetPropertyChangedSignal(“Occupant”):Connect(OccupantChanged)
Any help is much appreciated!