The title seems a bit vague, however I’m new to scripting and have just been messing around trying to figure a few things out. Basically what I’ve done is created a part which changes color when it is stepped on.
(The script I’m using )
script.Parent.Touched:connect(function(other)
if other and other.Parent:FindFirstChild(“Humanoid”) then
script.Parent.BrickColor = BrickColor.Green()
end
end)
Once I had this script figured out, I attempted to create a similar line of script that would change the color to gray when touched only if the color was green. However, I can’t figure out how to do this. It’s a simple script but I’m unfamiliar to lua. I tried including a requirement for the brick to be green, but the script demands a then statement when I try to define it.
(Script I tried to use to solve issue )
script.Parent.Touched:connect(function(other)
if other and other.Parent:FindFirstChild(“Humanoid”)and script.Parent.BrickColor = BrickColor.Green then
script.Parent.BrickColor = BrickColor.Gray()
end
end)
Any help would be appreciated. This script isn’t really of the upmost importance but I want to make myself familiar to the way it works.