This script was literally working yesterday. Now every time the Player jumps off the seat it freezes and crashes Roblox. I get no errors, parenting is correct. There's no reason it should be acting like this.
seat = script.Parent function onSitUp(child, Drift, EMP, GUI) if child.Parent == nil then Drift.Disabled = true EMP.Disabled = true Drift.Parent = script EMP.Parent = script GUI.Parent = script end end function onChildAdded(part) local char = script.Parent.Parent.Parent.Parent if char then local Drift = script["Drift"] local EMP = script["EMPscript"] Drift.Parent = char Drift.Disabled = false EMP.Parent = char EMP.Disabled = false local GUI = script["Controls"] local player = game.Players:GetPlayerFromCharacter(char) GUI.Parent = player.PlayerGui part.AncestryChanged:connect(function(child) onSitUp(child, EMP, GUI, Drift, script.Parent) end) end end seat.ChildAdded:connect(onChildAdded)
On Line 24
part.AncestryChanged:connect(function(child) onSitUp(child, EMP, GUI, Drift, script.Parent) end)
you give 5 variables to the SitUp function, yet the SitUp function only retains three?
Also, why do you need a wait(.1) within an if-statement?
On line 24, try swapping AncestryChange for ChildRemoved