Part effects work when part is sat on/not sat on, but when other part sat on effects glitch [EASY]?
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:
01 | script.Parent.Seat.Touched:connect( function (hit) |
03 | local player = game.Players:GetPlayerFromCharacter(hit.Parent) |
04 | if player.Character.Humanoid.Sit = = true then |
05 | for i,v in pairs (script.Parent.Model:GetChildren()) do |
06 | if v:IsA( "BasePart" ) then |
11 | if player.Character.Humanoid.Sit = = false then |
12 | for i,v in pairs (script.Parent.Model:GetChildren()) do |
13 | v.Material = "SmoothPlastic" |
Thanks!