How can i solve this problem

image
I don’t understand why the game giving me this eror.

Here’s the script.

local UIS = game:GetService(“UserInputService”)
local Player = game:GetService(“Players”).LocalPlayer
local Debounce = 1
local HH = script:WaitForChild(“Mochi”)
local HH1 = script.Mochi:WaitForChild(“ArmEffect”)
local HH3 = script.Mochi:WaitForChild(“UWU”)
local Char = Player.Character or Player.ChildAdded:Wait()
local Huma = Char:WaitForChild(“Humanoid”)
local Anime01 = script:WaitForChild(“Animation”)
local Anime02 = script:WaitForChild(“Animation2”)
local Anime03 = script:WaitForChild(“Animation3”)
local RME = script:WaitForChild(“RemoteEvent”)
local Animtracks1 = Huma:LoadAnimation(Anime01);
local Animtracks2 = Huma:LoadAnimation(Anime02);
local Animtracks3 = Huma:LoadAnimation(Anime03);
local Debounce1 = false
local Stun = Char:FindFirstChild(“Stun”)
local NOJUMP = true
local GT = script:WaitForChild(“GT”)
local RME1 = script.RemoteEvent:WaitForChild(“EE1E”)
local RR1 = script.Mochi:WaitForChild(“WWW”)
local Tool = script.Parent
local G = false
local Ji = script.Mochi:WaitForChild(“LLL”)
local Ji2 = script:WaitForChild(“Remo”)
local Ji3 = script.Mochi:WaitForChild(“DD1r1f”)
local Ji4 = script.Mochi:WaitForChild(“EEf112”)
local Ji5 = script.Mochi:WaitForChild(“Df1234”)

–3.322, 0.846, 3.077
Huma.FreeFalling:Connect(function(isJumping)
if isJumping then
NOJUMP = false
else
NOJUMP = true
end
end)

UIS.InputBegan:Connect(function(Input,IsTyping)
if not IsTyping then
if Input.KeyCode == Enum.KeyCode.Z and Debounce == 1 and not Debounce1 and NOJUMP == true then
Debounce1 = true
Animtracks1:Play();
HH1:FireServer(Player)
HH3:FireServer(Player)
Ji2:FireServer(Player)
wait()
Huma.WalkSpeed = 2.1
Debounce = 2
wait()
Animtracks2:Play();
wait(3)
Debounce1 = false
elseif Debounce == 2 and Input.KeyCode == Enum.KeyCode.Z then
Debounce = 1
end
end
end)

UIS.InputEnded:Connect(function(Input,IsTyping)
if not IsTyping then
if Input.KeyCode == Enum.KeyCode.Z and Debounce == 2 == true then
wait(0.1)
Animtracks3:Play();
Debounce = 3
Ji:FireServer(Player)
RME:FireServer(Player)
RME1:FireServer(Player)
RR1:FireServer(Player)
Ji3:FireServer(Player)
Huma.WalkSpeed = 16
Animtracks2:Stop();
wait(2)
Debounce = 1
end
end
end)

I might know what happened. On line 7, it says player.ChildAdded:Wait() and based off of the error, the Backpack was loaded so that became the Char variable. I would remove the player.ChildAdded:Wait() and replace it with player.CharacterAdded:Wait().

I’m not entirely if this change will work though

Maybe add a wait at the start so it has time to load everything before going through with the code

I didn’t notice this lol, yeah change that to player.CharacterAdded:Wait() for it to work