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)