So, in my Local Script, stored inside of a tool, doesn't run after all the variables are defined. Any solutions?
--Get player
local Player = game.Players.LocalPlayer
--Load
repeat wait() until Player.Character
repeat wait() until Player.Character.Humanoid
print("loaded")
--Get humanoid
local Humanoid = Player.Character.Humanoid
--Get Bools
local CanAttack = game.ReplicatedStorage.NewValues:WaitForChild(Player.Name):WaitForChild("CanAttack")
local AttackPlaying = game.ReplicatedStorage.NewValues:WaitForChild(Player.Name):WaitForChild("AttackPlaying")
--Get UserInputService
local UserInputService = game:GetService("UserInputService")
--Get animation track
local IdleTrack = Humanoid:LoadAnimation(game.ReplicatedStorage.Animations.IdleSplitter)
local WalkTrack = Humanoid:LoadAnimation(game.ReplicatedStorage.Animations.WalkSplitter)
local RunTrack = Humanoid:LoadAnimation(game.ReplicatedStorage.Animations.AllClassRun)
local LightAttackTrack = Humanoid:LoadAnimation(game.ReplicatedStorage.Animations.LightAttackSplitter)
local HeavyAttackTrack = Humanoid:LoadAnimation(game.ReplicatedStorage.Animations.HeavyAttackSplitter)
--Get hitbox
local Hitbox = script.Parent.Parent.Hitbox
--Get AttackFired
local AttackFired = game.ReplicatedStorage.BindableFunctions.Attack.AttackFired
local Hitbox = script.Parent.Parent.Hitbox
local HitDebounce = false
print("idle played")

11 comments
I forgot to say something, the print at the bottom doesnt print.
any errors?
Nope. No errors.
Make sure it's placed at a proper area where LocalScripts can run. StarterGui, StarterCharacter, ReplicatedFirst
It's inside of a Tool in StarterPack. It was working completely fine before, but it isn't working now.
Try to put it in StarterPlayerScript folder
repeat wait() should be replaced by either :WaitForChild() or event:Wait(), for example character should be "char = player.Character or player.CharacterAdded:Wait()" and humanoid should be "char:WaitForChild("Humanoid")"
also if it says anything like "Infinite yield on thing:WaitForChild()" that counts as an error and means the child cant be found
the repeat wait() works fine I put a print to test and it worked.
it works fine but it shouldnt be used anyways. it can wait longer than you might want it to which will ultimately cause problems
Didn't work :(