Script.Parent.Touched:connect(function() Script.Parent.BrickColor = BrickColor.new("Bright red") end)
Variable names are case-sensitive. For whatever reasons, script
is only provided as the lowercase script
. (This is because the convention for Lua names is camelCase while the convention for ROBLOX objects is PascalCase -- script
, as a variable and not the name of an object uses the Lua convention)
Use script
instead of Script
.
Your output would have hinted this to you! Learn to use your output! It would have said something like
attempt to index a 'nil' value, 'Script'
Which would mean there is no variable named Script
.