11:50:45.841 The Parent property of Handle is locked, current parent: NULL, new parent MegaLauncher - Server - Script:9

  1. What do you want to achieve? Keep it simple and clear!
    I made a gamepass that give a rocket launcher to the player.

  2. What is the issue? Include screenshots / videos if possible!
    It works the first time but on the second it comes up with this error;
    11:50:45.841 The Parent property of Handle is locked, current parent: NULL, new parent MegaLauncher - Server - Script:9

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I looked through the DevForum for help but nothing worked. Like Destroying the tool did not work.

Here’s my code;

local Mega = script.MegaLauncher:Clone()
local Handle = script.Handle:Clone()

game.Players.PlayerAdded:Connect(function(plr)
	local PLrId = plr.UserId
	
	plr.CharacterAdded:Connect(function()
		if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(PLrId, 26834191) then
			Handle.Parent = Mega
			Mega.Parent = plr.Character
		end
	end)
end)

The handle kept deleting itself so I did this and it worked. But still not fixed.

1 Like

add a small yield to the CharacterAdded function with a new thread

What do you mean? Could you please elaborate?

he probably meant

game.Players.PlayerAdded:Connect(function(player)
  local Char = player.Character or player.CharacterAdded:Wait()
end)

Would you mind taking a screenshot of your explorer?
Like this:
image

I am not sure why it doesn’t work for you but I just tested it and it works
image
image

Make sure all of your parts have the “Locked” property turned off.
Not too sure if this will work but it’s worth a shot.

I do recommend to add a bool to check if player really owns the gamepass. But it is optional for you to do the same thing.

local mps = game:GetService("MarketPlaceService")
local haspass = false

game.Players.PlayerAdded:Connect(function(player)
   haspass = mps:UserOwnsGamePassAsync(player.UserId, 000000) 
   if haspass then
  -- give player tool/ability
  else
  -- if player doesn't match with the gamepass ID then haspass will return false 
   end
end)

How would this work if the player died? It would not give it back to them.

Here is the explorer;


Everything is in ServerScriptService.

It’s working perfectly fine for me.
Here’s the file if you want to check it out:
DevForum1.rbxm (3.4 KB)

You should use the CharacterAppearanceLoaded event if you want a Character to fully load all of it’s Children so that you can properly parent your Tool

Also, if you want a Player to equip a weapon once given, call the Humanoid:EquipTool() function so that it’s automatically parented to your Character Model inside the workspace

local GamepassID = 26834191

local Players = game:GetService("Players")
local MPS = game:GetService("MarketplaceService")

local Mega = script:WaitForChild("MegaLauncher")
local handle = script:WaitForChild("Handle")
-- There is no need to be cloning it upon starting the script in the first place, it's better to clone it if the Player has the Gamepass to let it know when to give it

Players.PlayerAdded:Connect(function(Plr)
    local PlrId = Plr.UserId

    Plr.CharacterAppearanceLoaded:Connect(function(Chr)
        local Humanoid = Chr:WaitForChild("Humanoid")

        if MPS:UserOwnsGamePassAsync(PlrId, GamepassID) then
            local HandleClone = Handle:Clone()
            HandleClone.Parent = Mega

            local ToolClone = Mega:Clone()
            ToolClone.Parent = Chr
        end
    end)
end)
1 Like