First of all, What I am going to make is basically a giver that will be different compared to all the other old ones out there. First of all i'm using a part called Change which will be used to change my Booleanvalue. I have also added a Humanoid check. I think it might not be working because of my Humanoid check. I press play and walk on to my part, nothing happens. I have commented out parts and exchanged with Printing something and still nothing happens, No errors either. Here's the script:
SP = script.Parent SP.Touched:connect(function(hit) local Human_Check = hit.Parent:FindFirstChild("Humanoid") if Human_Check ~= nil and SP.BrickColor == ("Bright green") then print("HumanHere") SP.BrickColor = BrickColor.new("Bright red") SP.Parent.Enable.Value = false elseif Human_Check ~= nil and SP.BrickColor == ("Bright red") then SP.BrickColor = BrickColor.new("Bright green") SP.Parent.Enable.Value = true end end)
The problem is that you are not referring to the colors correctly. Even in if statements, they have to have BrickColor.new before them. Don't worry, it won't add a new color to the brick, even though it sounds like it might.
SP = script.Parent SP.Touched:connect(function(hit) local Human_Check = hit.Parent:FindFirstChild("Humanoid") if Human_Check ~= nil and SP.BrickColor == BrickColor.new("Bright green") then print("HumanHere") SP.BrickColor = BrickColor.new("Bright red") SP.Parent.Enable.Value = false elseif Human_Check ~= nil and SP.BrickColor == BrickColor.new("Bright red") then SP.BrickColor = BrickColor.new("Bright green") SP.Parent.Enable.Value = true end end)