Part Resize Detection Script Help

Hey all! I’m trying to make a script in a tool that will detect if the part is resized, and when it’s resized it’ll get deleted.

local tool = script.Parent
while true do
    wait (1)
    print ("Checking for resize...")
    tool.blade.Changed:Connect(function()
        print("Resized!")
        script.Parent:Destroy()
        print("Resize detected")
    end)
end

This is what I have so far, except the problem is that it’ll delete the part when I pull it out, is it possible for it to only delete the tool if a property is changed? I tried replacing changed with GetPropertyChangedSignal but then it won’t even print, I am very lost.

Any help would be appreciated!

1 Like

GetPropertyChangedSignal is what you want here, but another problem with your code is that you’re looping a connection, which you don’t want. Another small note is you use wait(), but you should be using the new task.wait() which is better.

Here’s what your new code would look like.

local tool = script.Parent

tool.blade:GetPropertyChangedSignal("Size"):Connect(function()
     print("Resized!")
     tool:Destroy()
end
3 Likes