For some reason, when I sit on a part and then get off of it the script works fine, but when I sit on another part, both the part that I had previously sat on and the part that I am now sitting on light up; https://gyazo.com/904a430766537e96d97ca06de386597d (photo of the hierarchy)
CODE:
script.Parent.Seat.Touched:connect(function(hit)
while wait() do
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player.Character.Humanoid.Sit == true then
for i,v in pairs (script.Parent.Model:GetChildren()) do
if v:IsA("BasePart") then
v.Material = "Neon"
end
end
end
if player.Character.Humanoid.Sit == false then
for i,v in pairs (script.Parent.Model:GetChildren()) do
v.Material = "SmoothPlastic"
end
end
end
end)
Thanks!

2 comments
Can you please post a screen shot of what this is doing so I can understand myself
When a player sits on one of these parts, it turns neon: https://gyazo.com/b01f950a6b7b581e9bac9318c164f02d. When they get off, it turns smoothplastic.