I'm wondering what is really the cause of my animation system not loading?
local player = game.Players.LocalPlayer mouse = player:GetMouse() enabled = true local StPlr = game.StarterPlayer local Rs = game.ReplicatedStorage local Double = Rs.CurrentAnims:WaitForChild("Double") local Back = Rs.CurrentAnims:WaitForChild("Back") local Idle = Rs.CurrentAnims:WaitForChild("Idle") local Down = Rs.CurrentAnims:WaitForChild("Down") local Up = Rs.CurrentAnims:WaitForChild("Up") local CharTr = player.Character -- running idle while true do repeat local PlayIdle = CharTr.Humanoid:LoadAnimation(Idle) PlayIdle:Play() wait(2.5) until mouse.Button1Down:Connect(function() if enabled then enabled = false local PlayDoublePunch = CharTr.Humanoid:LoadAnimation(Double) PlayDoublePunch:Play() wait(1.5) enabled = true end end) mouse.KeyDown:Connect(function(k) if k == 'c' then print("C is pressed") if enabled then enabled = false local PlayBackPunch = CharTr.Humanoid:LoadAnimation(Back) PlayBackPunch:Play() wait(1.5) enabled = true end end if k == 'q' then print("Q is pressed") if enabled then enabled = false local PlayUp = CharTr.Humanoid:LoadAnimation(Up) PlayUp:Play() wait(1.5) enabled = true end end if k == 'z' then print("Z is pressed") if enabled then enabled = false local PlayDown = CharTr.Humanoid:LoadAnimation(Down) PlayDown:Play() wait(1.5) enabled = true end end end) end
Output was "attempt to index global CharTr(a nil value)"
Hello, Stormtech6!
You just need to wait for the character to be created
local player = game.Players.LocalPlayer mouse = player:GetMouse() enabled = true local StPlr = game.StarterPlayer local Rs = game.ReplicatedStorage local Double = Rs.CurrentAnims:WaitForChild("Double") local Back = Rs.CurrentAnims:WaitForChild("Back") local Idle = Rs.CurrentAnims:WaitForChild("Idle") local Down = Rs.CurrentAnims:WaitForChild("Down") local Up = Rs.CurrentAnims:WaitForChild("Up") repeat wait() until player.Character --Waits for the character to be created local CharTr = player.Character -- running idle while true do repeat local PlayIdle = CharTr.Humanoid:LoadAnimation(Idle) PlayIdle:Play() wait(2.5) until mouse.Button1Down:Connect(function() if enabled then enabled = false local PlayDoublePunch = CharTr.Humanoid:LoadAnimation(Double) PlayDoublePunch:Play() wait(1.5) enabled = true end end) mouse.KeyDown:Connect(function(k) if k == 'c' then print("C is pressed") if enabled then enabled = false local PlayBackPunch = CharTr.Humanoid:LoadAnimation(Back) PlayBackPunch:Play() wait(1.5) enabled = true end end if k == 'q' then print("Q is pressed") if enabled then enabled = false local PlayUp = CharTr.Humanoid:LoadAnimation(Up) PlayUp:Play() wait(1.5) enabled = true end end if k == 'z' then print("Z is pressed") if enabled then enabled = false local PlayDown = CharTr.Humanoid:LoadAnimation(Down) PlayDown:Play() wait(1.5) enabled = true end end end) end
Good Luck with your games