Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

[Solved] Why doesnt my click detector detect clicks?

Asked by 5 years ago
Edited 4 years ago

Im trying to make a thing where theres an "elevator" and when i click a button it should change some stuff but for some reason it doesnt detect the click.Im really new to coding on roblox and any help is appreciated. Thank you!

Explorer:

https://imgur.com/a/bdUan4u

Code:

01local text = script.Parent
02local button = text.Parent.Parent.Button
03local detector = button.ClickDetector
04local floor = text.Floor.Value
05print("local stuff")
06 
07---------- functionns --------------------
08 
09 
10function startElevator()
11    print("elevator started")
12    floor = -6
13    wait(2.1)
14    floor = -5
15    wait(2)
View all 47 lines...

1 answer

Log in to vote
0
Answered by 5 years ago

Your while loop is blocking it from ever giving the MouseClick a function to go to.

Put the 'detector.MouseClick:connect(onMouseClick) above the while loop and it should work.

0
THANK YOU! EiOooAxea 70 — 5y
Ad

Answer this question