I'm trying to make a script that unanchors and turns "Black" when you click it one time, but reanchors itself and turns "Bright Green" when you click it a second time. The problem is, it won't work! Well here's the code:
1 --Made by Dozer86421
2 function onClicked
3
4 if Script.Parent.Anchored = True
5 Script.Parent.BrickColor=("Bright Green") do
6 Script.Parent.Anchored = False
7 Script.Parent.BrickColor = BrickColor.new("Black")
8
9 elseif Script.Parent.Anchored = False
10 Script.Parent.BrickColor=("Black") do
11 Script.Parent.Anchored = True
12 Script.Parent.BrickColor = BrickColor.new("Bright Green")
13 end
14 Script.Parent.ClickDetector.MouseClick:connect(onClicked)
Well that's the code I've been using! I put a "ClickDetector" in a brick named Part and put this script in too!!! Output keeps on telling me:
Workspace.Part.Script:4: '(' expected near 'if'
And it's really annoying too. It's one of the first times I've used Output, and I'm a beginner with scripting and both of those don't help me at all. Please reply to this so I can complete my script. |