i dont know why it said tool is not valid member of folder and I’ve tried many things like adding FindFirstChild(), print(), warn() and etc. but none of these are working. and this is my setup
Inside the handle script
local db = false
script.Parent.ClickDetector.MouseClick:Connect(function(plr)
if db == false then
db = true
local backpack = plr:WaitForChild("Backpack")
local tool = game.Workspace.Items.Tool or backpack
if tool then
tool.Parent = backpack
end
db = false
end
end)
and the player script,i put it on StarterPlayerScript
backpack = game.Players.LocalPlayer:WaitForChild("Backpack")
backpack.ChildAdded:Connect(function(child)
local childamount = #backpack:GetChildren()
if childamount > 1 then
for i,tool in pairs(backpack:GetChildren()) do
if tool ~= child then
tool.Parent = game.Workspace.Items
tool.Handle.Position = child.Handle.Position
end
end
end
end)
Im sorry if you guys dont understand what im saying and what im trying to do, this is what i can do thanks
Not sure when you are trying to find tool. But i am letting you know that when a tool is equipped it moves from where ever it was in backpack to the actually workspace inside the character. So if your trying to get tool inside the folder as soon as its equipped it wont work.
local tool = workspace.Items:WaitForChild("Tool",10)
The timeOut parameter is used to prevent the infinite yield error, so the thread doesn’t yield indefinitely and instead breaks and returns nil instead, if the instance was still not found
@Friskyman321 did you read my post? It’s literally right above.
That error occurs when an instance was not returned within 5 seconds, this could be dangerous because you would otherwise be waiting for an instance to return when it doesn’t even exist.
instead of getting Local Player through a long line of code, because anything in StarterPlayerScripts is replicated directly to the Player, with the Player as it’s Parent.