What I am doing is making a remote and it has Up,Down,Left, and Right. What I am trying to do is click it. It worked when I just did it with the up key, but when trying adding the others in, it didn't even work. It didn't move to the position for 0.05 seconds and back up. Hope you understand what I am trying to do here and asking here. Thank you!
up = script.Parent.Up
down = script.Parent.Down
left = script.Parent.Left
right = script.Parent.Right
upOn = false
downOn = false
leftOn = false
rightOn = false
function onClicked()
if not upOn then
upOn = true
up.CFrame = up.CFrame+Vector3.new(0,-0.09,0)
wait(0.05)
up.CFrame = up.CFrame+Vector3.new(0,0.09,0)
upOn = false
end
else if not downOn then
downOn = true
down.CFrame = down.CFrame+Vector3.new(0,-0.09,0)
wait(0.05)
down.CFrame = down.CFrame+Vector3.new(0,0.09,0)
downOn = false
end
else if not leftOn then
leftOn = true
left.CFrame = left.CFrame+Vector3.new(0,-0.09,0)
wait(0.05)
left.CFrame = left.CFrame+Vector3.new(0,0.09,0)
leftOn = false
end
else if not rightOn then
rightOn = true
right.CFrame = right.CFrame+Vector3.new(0,-0.09,0)
wait(0.05)
right.CFrame = right.CFrame+Vector3.new(0,0.09,0)
rightOn = false
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)

8 comments
else if... use elseif
Yeah, use elseif with no space
I did that, but that didn't work.
First of all, keep in mind that I cannot see your code. This is the code that you made and I am merely fixing the bugs which you had.
Secondly, the error is exactly as it means. You one, either don't have a click detector in the model or, two, you did not reference the model properly. I don't know what line 53 is so I cannot help you unless you post me a picture of your stuff and your full code.
Do accept the answer because I did help you in this context. And also post your pictures so I can help you more.
I accepted your answer. Should I re-ask it then?
Along with the picture?