What this script is suppose to do is when you sit down in the vehicle seat then you are suppose to have your body's transparency to == 1 then when you get up off the seat you will have your transparency to = 0
script.Parent.Touched:connect(function(hit) if hit.Parent.Humanoid.Sit == true then for i, p in pairs(hit.Parent:GetChildren()) do p.Transparency = 1 end end if hit.Parent.Humanoid.Sit == false then for i, p in pairs(hit.Parent:GetChildren()) do p.Transparency = 0 end end end)
Ok, well first of all, you haven't checked to see if humanoid is actually existent nor whether the player exists. Also, in the for loop you haven't checked to see if p is a part. These could all lead to problems, for example if any part touched that, the script would be broken for the duration of the time that server's up, simply because the script returned an error because it was told that the part had a humanoid with it didn't! Here's the fixed code:
script.Parent.Touched:connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") ~= nil and game.Players:FindFirstChild(hit.Parent.Name) ~= nil then -- Check if there's a humanoid and the player exists. if hit.Parent.Humanoid.Sit == true then for i, p in pairs(hit.Parent:GetChildren()) do if p:IsA("BasePart") and v.Name ~= "HumanoidRootPart" then -- Check if it's a part and isn't the humanoid root part. p.Transparency = 1 end end end if hit.Parent.Humanoid.Sit == false then for i, p in pairs(hit.Parent:GetChildren()) do if p:IsA("BasePart") and v.Name ~= "HumanoidRootPart" then -- Check if it's a part and isn't the humanoid root part. p.Transparency = 0 end end end end end)
If this works for you or helps you to understand please vote up and accept this as your answer.