When you sit in a seat, the script is supposed to make the vehicle become a child of the player's character. However, the script is not working, and I have no idea why it is doing this. Output did give me something. Can someone please help me? Here's the script:
function onChildAdded(part) if part.className == "Weld" then local torso = part.Part1 if torso ~= nil then local parent = torso.Parent if parent ~= nil then local player = game.Players:findFirstChild(parent.Name) script.Parent.Parent.Parent.Parent.Parent = parent local tool = script.Turret:Clone() tool.Parent = player.Backpack end end end end function onChildRemoved(part) local player1 = game.Players:findFirstChild(script.Parent.Parent.Parent.Parent.Parent.Name) player1.Backpack.Turret:remove() end script.Parent.ChildRemoved:connect(onChildRemoved) script.Parent.ChildAdded:connect(onChildAdded)
Output: 19:25:13.768 - Attempt to set Workspace.Player as its own parent 19:25:13.768 - Script 'Workspace.Tank.Turret.Device.Seat.Seracore', Line 8
This is the organization of the model: Tank>Turret>Device>Seat>The script (Seracore)
Then the model goes into the player's character and becomes a child of the player's character.
The error means you are accidentally executing the command "workspace.Player.Parent = workspace.Player". I'm guessing you had one too many ".Parent" 's on line 8 (based on your comments, I'm not sure if you're saying the current script is functional or not).
It might be easier to work with if you assign "script.Parent.Parent.Parent.Parent" to a variable, making it easier to fix if you have too many or too few ".Parent"s.