I have a local script that puts an aura around the player when I press q and then unequips when I press q but when I tried to equip it again there is an error that says " The Parent property of Bubble is locked, current parent: NULL, new parent HumanoidRootPart"
script:
local player = game.Players.LocalPlayer local mouse = player:GetMouse(); local tool = player.Backpack.ElectroBubble; local toggle = false local attachment = Instance.new("Attachment") local ElectroBubble = game.ReplicatedStorage.Bolts:Clone() local ElectroBubble2 = game.ReplicatedStorage.Bubble:Clone() mouse.KeyDown:connect(function(key) if not toggle and key == "q" then player.Character.Humanoid:EquipTool(tool) player.Character.LowerTorso.Locked = false attachment.Name = "Bubble" attachment.Parent = player.Character.LowerTorso ElectroBubble.Parent = player.Character.LowerTorso.Bubble ElectroBubble2.Parent = player.Character.LowerTorso.Bubble player.Character.Humanoid.WalkSpeed = 32 toggle = true elseif toggle == true and key == "q" then player.Character.Humanoid:UnequipTools(tool) attachment:Destroy() ElectroBubble:Destroy() ElectroBubble2:Destroy() player.Character.Humanoid.WalkSpeed = 16 toggle = false end end)
Your facing this issue because your destroying such bubble and not cloning the bubble again. Using :Destroy() will set the parent to nil and lock the parent, you could do the following:
A. Since you have a reference to it, you could set it to nil and then set it back to the lowertorso once pressing q again or B. Destroy the bubble and then make another bubble after pressing Q. (I see your already doing this but the local values are already set at the top of the script, it should set those local values after pressing q instead.)