I really don’t get why this isn’t working when it should be working.
I’m getting the value of ObjectValue which is an instance and then getting the Parent of that ObjectValue.Value… which works.
But as soon as I try to do anything with that it goes poof, gone.
local Dependent = Button:FindFirstChild("Dependent")
if Dependent then
local DepValue = Dependent.Value
local DepButton = DepValue.Parent
print(DepValue)
print(DepButton)
for _,part in ipairs(DepButton:GetChildren()) do
if part:IsA("BasePart") then
part.Transparency = 0
part.CanCollide = true
end
end
end
--[[ -- Output
18:31:49.947 Head - Server - Script:91
18:31:49.947 Top Level_Button - Server - Script:92
18:31:50.830 Workspace.TycconTest1 ------.Script:89: attempt to index nil with 'Parent' - Server - Script:89
]]
If you’re using a plugin that creates an ObjectValue, try doing it manually by inserting an object and copying the same property the plugin objectvalue has.
Yes, it’s intentional, the CanTouch boolean is a boolean that returns the touched function as true or false, which means the touch function activates if the CanTouch function is true, even if the CanCollide value is set to false.