Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

What does this error mean? " The Parent property is locked, current parent: NULL

This code works until the character dies and then respawns. If they click on the item once they have respawned I get this error " The Parent property of Science is locked, current parent: NULL, new parent Backpack" And it will not clone the item into the players backpack. The only thing I could find in Wiki was that a parent property locked and set to null on an instance happens when an object is removed or destroyed, which would obviously happen when the player dies, so why would that error occur once a character respawns and how can I fix that?

local RE = game.ReplicatedStorage
local event = RE.Notify
local event2 = RE.ScienceEvent
local klone = game.ServerStorage:FindFirstChild("Science"):Clone()
db = false
event2.OnServerEvent:Connect(function(plr)
	if db == false then
	db = true
			if klone.Parent ~= plr.Backpack then
				klone.Parent = plr.Backpack
			    event:FireAllClients(plr.Name.." found the Science Room Key!")
			end
	wait(35)
	db = false
	end
end)

--Here is the local script


local clickdetector = game.Workspace.Science.h.ClickDetector
clickdetector.MouseClick:Connect(function()
	game.ReplicatedStorage.ScienceEvent:FireServer()
end)

2 comments

0

try putting local 'klone = game.ServerStorage:FindFirstChild("Science"):Clone()' inside the event2 function in the script

0

Thank you, thank you Vlym. That worked!!! YAY :)

1 answer

✓ Accepted answer

Question. May I have the server event? It seems like a server event problem.

Edit: Sorry I could not get it in time. I was busy

2 comments

0

I added the local script up there in my post. thanks so much for looking at it HeyItzsccop :)

0

No problem. Edited

This discussion is preserved as it was. New answers, comments, and votes are closed.