Tool breaks when player dies

I have a tool that gives the player a forcefield for a period of time, but if they die they don’t get the tool stops giving the player the forcefield effect.

local script:

tool.Activated:Connect(function()
	if deb == false then
		deb = true
		tool.shield:FireServer(duration, Character)
		game:GetService("StarterGui"):SetCore("ResetButtonCallback", false)
		wait(duration)
		game:GetService("StarterGui"):SetCore("ResetButtonCallback", true)
		wait(duration * 2)
		deb = false
	end
end)

server script:

tool.shield.OnServerEvent:Connect(function(plr, duration, Character)
	local FF = Instance.new("ForceField")
	FF.Parent = Character
	FF.Visible = true
	tool.Handle.Transparency = 1
	wait(duration)
	FF:Destroy()
	wait(duration * 2)
	tool.Handle.Transparency = 0
end)

There isn’t anything wrong with your scripts. Tools disappear when a player dies. You need to figure out a way to give player tools when they die.

2 Likes

I don’t get it, I set it so if the player dies it removes the tool but it still doesn’t work.

When a character dies, it’s parent is then nil, and when the character loads again, then it’s a new character, so that’s why you use Player.CharacterAdded:Wait() when they die, try doing this and maybe your problem will be solved!