I still cannot figure this one out. I am trying to delete a car if a person sitting in the driver's seat leaves the game.
local Seat = script.Parent game.Players.PlayerRemoving:Connect(function(p) Seat.Touched:Connect(function(hit) if hit.Parent.Occupant == p.Name then script.Parent.Parent:Destroy() end end) end)
Any help is appreciated. (the script is in the seat)
local Players = game:GetService("Players") -- Player Service Players.PlayerRemoving:Connect(function(User) -- User Arguement local Humanoid = User.Character:FindFirstChildOfClass("Humanoid") -- Humanoid. Humanoid.SeatPart:Destroy() -- The seat the user sitting in. end)
The seat part will be the seat part not the model, you can figure this from here on now. Hope this helped, make sure to give a response if you need anything else.