-
What do you want to achieve?
For the tool to be parented to workspace when unequipped
-
What is the issue?
Met with this error:
Something unexpectedly tried to set the parent of Kalmar Flag to Workspace while trying to set the parent of Kalmar Flag. Current parent is Backpack.
- What solutions have you tried so far?
I can’t find anything on the forums or DevHub about something like this
script.Parent.Unequipped:Connect(function()
local character = script.Parent.Parent.Parent.Character
script.Parent.Parent = workspace
end)
local Tool = script.Parent
Tool:GetPropertyChangedSignal("Parent"):Connect(function()
if Tool.Parent:IsA("Backpack") then
local character = script.Parent.Parent.Parent.Character
Tool.Parent = workspace
end
end)
Tools automatically get parented to the player backpack when they’re unequipped. You’re trying to set the parent of the tool at the same time that Roblox is setting it to the backpack. Instead, you could change the parent to workspace after the parent changes to the backpack, or simply add a task.wait() (or repeat task.wait() until Tool.Parent == Backpack) before the line that changes the parent. I suggest you use PropertyChangedSignal to prevent any other issues.