Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

how do I fix "The Parent property of Bubble is locked, current parent: NULL?

Asked by
AM910sk 22
4 years ago

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)
0
'current parent: NULL' means 'current parent: NOTHING' i think User#29913 36 — 4y

1 answer

Log in to vote
0
Answered by
moo1210 587 Moderation Voter
4 years ago
Edited 4 years ago

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.)

0
The same error happens AM910sk 22 — 4y
0
Then you still aren't cloning A NEW bubble and using an old bubble that is destroyed. moo1210 587 — 4y
0
Then you still aren't cloning A NEW bubble and using an old bubble that is destroyed. moo1210 587 — 4y
Ad

Answer this question