I’m trying to make a script that detects when a player has a Tool of a certain name equipped. I’m trying to use :ChildAdded but I don’t think this is ideal as it doesn’t work, because the Tool is already in the players Character, it’s name just changes, therefore :ChildAdded doesn’t detect this. I was wondering if I could have some help on what to use as an alternative of the :ChildAdded event for this. Thanks!
Player.Character.ChildAdded:Connect(function(chid)
if isInTable(Order, chid.Name) then
print("Player got item that was in order")
local ItemName = chid.Name
for Index, Child in ipairs(ItemHolder:GetChildren()) do
if Child.Name == ItemName and Child.ItemName.TextColor3 ~= Color3.fromRGB(25, 200, 255) then
Child.ItemName.TextColor3 = Color3.fromRGB(25, 200, 255)
break
end
end
end
The following code doesn’t seem to be working. Know why?
Player.Character.ChildAdded:Connect(function(chid)
chid:GetPropertyChangedSignal("Name")
if isInTable(Order, chid.Name) then
print("Player got item that was in order")
local ItemName = chid.Name
for Index, Child in ipairs(ItemHolder:GetChildren()) do
if Child.Name == ItemName and Child.ItemName.TextColor3 ~= Color3.fromRGB(25, 200, 255) then
Child.ItemName.TextColor3 = Color3.fromRGB(25, 200, 255)
break
end
end
end
if isOrderComplete() then
OrderFrameGui.FinishButton.Visible = true
end
end)
Player.Character.ChildAdded:Connect(function(chid)
chid:GetPropertyChangedSignal("Name"):Connect(function()
if isInTable(Order, chid.Name) then
print("Player got item that was in order")
local ItemName = chid.Name
for Index, Child in ipairs(ItemHolder:GetChildren()) do
if Child.Name == ItemName and Child.ItemName.TextColor3 ~= Color3.fromRGB(25, 200, 255) then
Child.ItemName.TextColor3 = Color3.fromRGB(25, 200, 255)
break
end
end
end
if isOrderComplete() then
OrderFrameGui.FinishButton.Visible = true
end
end)
end)