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

ClickDetector.CursorIcon changing in script, but not while in function, why?

Asked by 4 years ago

Hello. I made a script that changes the door handle clickdetector icon depending on if it is open or not.

01prefix = "rbxassetid://"
02openIcon = "6081347829"
03closeIcon = "6081348044"
04knockIcon = "6081347938"
05chainIcon = "6081348125"
06outerPlace = script.Parent.Parent.OuterKnob.OuterKnob.ClickDetector
07innerPlace = script.Parent.Parent.InnerKnob.InnerKnob.ClickDetector
08bodyPlace = script.Parent.Parent.DoorBody.ClickDetector
09chainPlace = script.Parent.Parent.HalfLockAccept.ClickDetector
10 
11bodyPlace.CursorIcon = prefix..knockIcon
12chainPlace.CursorIcon = prefix..chainIcon
13outerPlace.CursorIcon = prefix..openIcon
14innerPlace.CursorIcon = prefix..openIcon
15 
View all 26 lines...

The icon gets changed as soon as the server starts and as this script is ran, but when the event is fired and the function is ran, it doesn't change. The if statement works, I tested it in the debugger. Also in the watch window, the outerPlace.CursorIcon and innerPlace.CursorIcon variables change but these changes aren't reflected in the game. Does anyone have any idea why it doesn't change?

0
is it a local script? Harry_TheKing1 325 — 4y
0
No. vonotige 49 — 4y
0
Doing things on the client (ex: a mouse or anything thats on their screen) should be handled on a local script. kepiblop 124 — 4y
0
But, It's a clickdetector, it changes the mouse for all players. Plus localscripts run code only in a limited amount of places. That means I can't just put it into this model and it would work. vonotige 49 — 4y

Answer this question