Hello, when a player picks up a tool from workspace/equips a tool from their backpack, the tool is parented to the character via the ChildAdded event. Is there any way to distinguish if a tool was picked from the character’s backpack or from workspace? In other words, how can you detect the previous parent of a tool before it was added to the character?
this is a tool, there are a lot of ways to do it but
how to detect a parent is changed?
tool:GetPropertyChangedSignal("Parent"):Connect(function()
1 Like
I’d use that and also store the old parent as a variable.
I got something to work using attributes and the AncestryChanged event
for i, v in pairs(list) do
if v then
v:SetAttribute("PrevParent", v.Parent.Name)
end
end
char.ChildAdded:Connect(function(v)
if v:IsA("Tool") then
task.wait()
local check = v:GetAttribute("PrevParent")
if check == bp.Name then return end --if tool's from bacpack then return
end
end)
Thanks for the idea
Actually I didn’t even need the ancestryChanged event bruh, idek how this code works
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.