local clone = CollectionService:GetTagged("ClonePrompt")
local tool = CollectionService:GetTagged("Tools")
for i,prompt in pairs(clone) do
local part = prompt.Parent
local tool = game.ReplicatedStorage:WaitForChild("Pod")
prompt.Triggered:Connect(function(h)
local newTool = tool:Clone()
newTool:AddTag("Tools")
newTool.Parent = h.Backpack
part:Destroy()
end)
end
for i,tool in pairs(tool) do
tool.Activated:Connect(function()
tool:Destroy()
end)
end```
It doesnt seem to work
#How do I make Collection service apply to clones tools?
1 messages · Page 1 of 1 (latest)
** You are now Level 1! **
you're applying it correctly, but you need to redo GetTagged after setting it
you're reusing the same old list, not getting the new updated one
Sorry for the late reply, but how should I call get tagged again?
youre not using it at all before the 2nd loop, so you could just call it for the first time right above it
like:
local tool = CollectionService:GetTagged("Tools")
for i,tool in pairs(tool) do
tool.Activated:Connect(function()
tool:Destroy()
end)
end
you also have several variables with the same name which i dont recommend
can get confusing
Like this?
wait I forgot to change a tag
local CollectionService = game:GetService("CollectionService")
local clones = CollectionService:GetTagged("Clone")
for i,prompt in pairs(clones) do
local part = prompt.Parent
local toolToClone = game.ReplicatedStorage:WaitForChild("Pod")
prompt.Triggered:Connect(function(h)
local newTool = toolToClone:Clone()
newTool:AddTag("Tool")
newTool.Parent = h.Backpack
part:Destroy()
end)
end
local tools = CollectionService:GetTagged("Tool")
for i,tool in pairs(tools) do
tool.Activated:Connect(function()
tool:Destroy()
end)
end