I have tried to bring a tool to workspace from player backpack and it just gives this warning and doesnt work at all, does anyone know any solutions for this? This is the code that is relevant to the problem.
local thekicked = datplace:GetChildren()[#datplace:GetChildren()] --datplace is the player backpack
if table.find(require(game.ServerStorage.DataStorage).CurrentMaterials,thekicked.Name) then
thekicked.Parent = workspace.Material
thekicked.Parent = workspace.Items
thekicked.Handle.Position = script.Parent.HumanoidRootPart.Position + script.Parent.HumanoidRootPart.CFrame.LookVector*5
If anyone has a solution, I would really appreciate it if you post it, thanks.
This error is caused when you attempt to set the parent of an instance while the parent is already being set. An example of a script causing this is:
local part = Instance.new"Part"
part.Parent = nil -- this will trigger the error because it detects the parent changing and immediately attempts to set it before the original parent change can finish.
You haven’t given us your whole script so i’m just going to assume that this is a parent changed connection (or descendant removing or something similar), so just add a task.wait() before setting the parent.