Tool Script Refresh

Hello, I have been doing some testing lately and this might be the reason why it’s bugged. Do scripts refresh upon player death when it is in a tool? Like scripts in StarterCharacterScripts?

-- Services
local UIS = game:GetService("UserInputService")
local RS = game:GetService('ReplicatedStorage')

local CameraShaker = require(RS.Modules.CameraShaker)

--Remote Events
local Atsu = RS:WaitForChild('Fruits').Atsu
local ability = Atsu.ability
local explosion = RS:WaitForChild('Modules').CSRE.explosion

-- Variables
local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local hum = char:WaitForChild('Humanoid')

local tool = script.Parent
local camera = workspace.CurrentCamera
local isEquipped = false

local heatballCool = false
local rageCool = false

--Fastcast Settings
local mouse = player:GetMouse()

local connect
	isEquipped = true
	connect = UIS.InputBegan:Connect(function(input, isTyping)
		if (isTyping or isEquipped == false) then

		if (input.KeyCode == Enum.KeyCode.E and heatballCool == false) then
			ability:FireServer(1, mouse.Hit)
			heatballCool = true
			heatballCool = false
		elseif (input.KeyCode == Enum.KeyCode.C and rageCool == false) then
			rageCool = true
			hum.WalkSpeed = 0
			hum.JumpPower = 0
			hum.WalkSpeed = 16
			hum.JumpPower = 50
			rageCool = false

It works the first time, but when the player dies, the walkspeed won’t change. Everything else works except the walkspeed and jump power.

If anyone has any ideas, let me know since this is very confusing.


If you wanna make it work after respawning, you need to put it StarterPack.

Also, when the plr dies, the character changes, so you mite want to wrap it up in a CharacterAdded fjbcyion.

Tool scripts will re-execute when the player dies as the tool is cloned into the player’s Backpack folder when they respawn.

local player = game.Players.LocalPlayer
local char = player.Character

Try this block of code instead.

Thank you, if possible, could you explain why this block of code works alternatively? Rather than my original code?