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.

9 comments
Where is your ending for the PlayerAdded?
Oops. Forgot to add that. It's in the script, I just didn't post it.
Alright I edited the post to include the PlayerAdded
ChildAdded**, in line 07 the player part doesn't make sense.
It worked before, nowI have no idea why it is not working now.
I believe you have to use the "GetPlayerFromCharacter"
Then it must be the ROBLOX Update.
No ROBLOX update took place has occurred in the past day, at least as far as I know
I think I fixed it. Thanks