File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 9595function SlotButton .setTool (self : ClassType , tool : Tool | HopperBin ? )
9696 self .tool = tool
9797
98- if tool then
99- self :setText (tool .Name )
100- self :setIcon (tool .TextureId )
101- if tool :IsA ("Tool" ) then
102- self :setTooltip (tool .ToolTip )
98+ local function onToolChange ()
99+ if self .tool then
100+ self :setText (self .tool .Name )
101+ self :setIcon (self .tool .TextureId )
102+ if self .tool :IsA ("Tool" ) then
103+ self :setTooltip (self .tool .ToolTip )
104+ end
105+ else
106+ self :setText ("" )
107+ self :setIcon ("" )
108+ self :setTooltip ("" )
103109 end
104- else
105- self :setText ("" )
106- self :setIcon ("" )
107- self :setTooltip ("" )
108110 end
111+ onToolChange ()
112+
113+ local toolChangedConnection = tool .Changed :Connect (function (property )
114+ if property == "Name" or property == "TextureId" or property == "ToolTip" then
115+ onToolChange ()
116+ end
117+ end )
118+ table.insert (self ._connections , toolChangedConnection )
109119end
110120
111121function SlotButton .setText (self : ClassType , text : string )
You can’t perform that action at this time.
0 commit comments