The Parent property of HitEffect is locked, current parent: NULL, new parent Workspace

The Parent property of HitEffect is locked, current parent: NULL, new parent Workspace

local findcoins = game.Workspace:FindFirstChild(“Coin”)
effect.Parent = game.Workspace
effect.CFrame = findcoins.CFrame

1 Like

The error means you’re trying to set the parent of something that’s been destroyed (aka something that had :Destroy called on it).

2 Likes

how to fix that idk how to fix that

1 Like

Remove the part of the script where it destroys the effect

2 Likes

i was trying to do coin bomb like i press y and throw the coin and press h to detonate the bomb .
and this is my script

local rep = game:GetService(“ReplicatedStorage”)
local effect = script.HitEffect:Clone()
–local anim = script.Det:Clone()
local explode = script.Explosion:Clone()

rep.Stand.KQ.Detonate.OnServerEvent:Connect(function(Player)
local DetSound = script.DetSound:Clone()
DetSound.Parent = char

DetSound:Play()
wait(0.6)
local char = Player.Character
local hum = char.Humanoid

local findcoins = game.Workspace:WaitForChild("Coin")

if findcoins then
	effect.Parent = game.Workspace 
	effect.CFrame = findcoins.CFrame
	explode.Parent = findcoins
	explode:Play()
	wait(2.4)
	findcoins:Destroy()
	effect:Destroy()
	explode:Destroy()
	
	effect.Touched:Connect(function(hitpart)
		if not hitpart:IsDescendantOf(char) then
			if hitpart.Parent:FindFirstChild("Humanoid") then
				local enemy = hitpart.Parent
				if (table.find(ignorelist,enemy) == nil) then
					table.insert(ignorelist,enemy)
					enemy.Humanoid:TakeDamage(12.5)
					enemy.WalkSpeed = 5
					wait(1.6)
					enemy.WalkSpeed = 16
				end
			end
		end
	end)			
end

end)

the problem is you need to put the

local effect = script.HitEffect:Clone()

inside the

rep.Stand.KQ.Detonate.OnServerEvent:Connect(function(Player)

or the effect wont exist in the second time you run the function

2 Likes

Instead of destroying the particles do effect:Remove()

It worked for me

1 Like