I'm making a tower defense game and there's an error with my code and the output says "Config is not a valid member of Model "Archer"" while it is. It will change the model to the next upgrade but wont change the stat info on the GUI. Can someone help me? Thanks
function tower.Attack(newTower, player)
local Config = newTower.Config
local target = FindNearestTarget(newTower, Config.Range.Value)
if target and target:FindFirstChild("Humanoid") and target.Humanoid.Health > 0 then
local targetCFrame = CFrame.lookAt(newTower.HumanoidRootPart.Position, target.HumanoidRootPart.Position)
newTower.HumanoidRootPart.BodyGyro.CFrame = targetCFrame
animateTowerEvent:FireAllClients(newTower, "Attack")
target.Humanoid:TakeDamage(Config.Damage.Value)
if target.Humanoid.Health <= 0 then
player.Gold.Value += target.Humanoid.MaxHealth
end
task.wait(Config.Cooldown.Value)
end
(The error is on line 2)
