I am trying to make a plugin which shows the part’s size on a TextLabel.Text property. However it doesn’t detect the change in scale when scaled using the scale tool. Only updates the value whenever I select out of it, and select it again.
:GetPropertyChangedSignal doesn’t fire for updated objects defined in a variable.
It only fires for the object I used to initialise the variable. No matter how many times I defined the variable.
Here is the code:
local currentlySelect = workspace['PLUGINPart_DoNotRemove_1a2b3c4de5f6'] local function getObject(gui) local obj = Selection:Get() if obj == nil or not obj:IsA('Part') then return end GetSize(obj, gui) currentlySelect = obj return obj end local gui = script.Parent.ScreenGui gui.Parent = game.CoreGui gui.TextLabel.Text = 'TEST' Selection.SelectionChanged:Connect(function() currentlySelect = getObject(gui) end) Selection.SelectionChanged:Connect(function() currentlySelect = getObject(gui) end) currentlySelect:GetPropertyChangedSignal('Size'):Connect(function() GetSize(currentlySelect, gui) end)
For debugging purposes, I’ve added a
while true loop in a coroutine which prints the value of
currentlySelected, it does print the updated value. So, the issue lies within
:GetPropertyChangedSignal not being able to receive the new value.
Hoping to use Instance.new(‘Part’) to initialise the variable.