Whenever my character respawns this stops printing

So I added prints in my code, and from what I can tell where it prints ‘3’ when you first spawn in the game after you reset your character once you respawn it no longer prints 3. Why is this?

print'1'
local Player = game.Players.LocalPlayer
local Tool = script.Parent
local Character = Player.Character or Player.CharacterAdded:Wait()
local Animator

local cantClick = false

local Hum = Character:WaitForChild("Humanoid", 10000)
local Root = Character:WaitForChild("HumanoidRootPart", 10000)
local UIS = game:GetService("UserInputService")
local unequippedduringhold = false

local Attack = 1
local LastClick
local mod = require(script:WaitForChild("Mod"))
local holding = false
local equipped
local HoldingTrack
local SlashingTrack

print'2'

if not Character.Parent then
	repeat wait() until Character.Parent
end

print'3'

The script is only running once.

It’s located in Starterpack inside of a tool. It runs any time I respawn.

Well if you die the tool will reset since it’s local script? Maybe wrong

When you die starterpack auto resets the localscript for when you respawn meaning it reruns the code if your script is inside of something like a tool. It’s supposed to wait for the character’s parent before allowing animations to play but for some reason this script doesn’t do this.

1 Like

Try this.

if not Character.Parent then

repeat wait() local Character = Player.Character until Character.Parent

end