so i have completed my combat system, and i’am very pleased with it; however when i die it does not work… here is how i formatted my stuff
ignore magic modulescript
the code in Core is the following:
for _, Module in pairs(script:GetChildren()) do
if Module:IsA("ModuleScript") then
require(Module)
end
end
and Controls script contents being:
for _, Module in pairs(script:GetChildren()) do
if Module:IsA("ModuleScript") then
require(Module)
end
end
return nil
not sure if this matters but inside Combat the script uses this to define the player
local Player = Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
these scripts are located in starterplayer>starterplayerscripts; please do not tell me to move them unless you would know how to fix the script (when i move the module structure into any other area it will break)
if you need the full code please tell me (:
after i die here is the error in the output:
(this is coming from the animation module so here is the code for animation module)
--//Services
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
--// Assets
local Assets = ReplicatedStorage:WaitForChild("Assets")
local Animations = Assets:WaitForChild("Animations")
local Binds = ReplicatedStorage:WaitForChild("Binds")
local GetTrack = Binds:WaitForChild("GetTrack")
local Animate = Binds:WaitForChild("Animate")
--// Module
local Animator = {
Play = function(Humanoid,AnimationName)
local Animation = Animations:FindFirstChild(AnimationName)
if Animation then
local Track = Humanoid:LoadAnimation(Animation)
Track:Play()
end
end,
PrepeareTrack = function(Humanoid,AnimationName)
local Animation = Animations:FindFirstChild(AnimationName)
if Animation then
local Track = Humanoid:LoadAnimation(Animation)
return Track -- returns a already set up animation track so it can be used later
end
end,
}
--//Main
GetTrack.OnInvoke = function(Humanoid,AnimationName)
return Animator.PrepeareTrack(Humanoid, AnimationName)
end
Animate.Event:Connect(function(Humanoid,AnimationName,Task)
Animator[Task](Humanoid,AnimationName)
end)
return Animator
(how it fires to the animator)
local Track = GetPlayerTrack(Character:WaitForChild("Humanoid"),Combos[ComboCount])
Track:AdjustSpeed(1.5)
Track:Play()
TDLR; why is my combat breaking after i die?!