local db = false -- Personal creep stats -- local slashanim = script.slashanim local…
- User
local db = false
-- Personal creep stats --
local slashanim = script.slashanim local atkspeed = 70/50 local dps = math.random(19, 21)
local pathfindingService = game:GetService("PathfindingService") local creepsattackrange = 20 local targetCreepListDire = {} local targetCreepListRadiant = {} local waypoints = {} local dfws = 12 local fighting = false
local function attackCreep(creep, enemycreep) if enemycreep.Humanoid.Health > 0 and creep.Humanoid.Health > 0 then fighting = true waypoints = {} creep.Humanoid:MoveTo(enemycreep.HumanoidRootPart.Position) if (creep.HumanoidRootPart.Position - enemycreep.HumanoidRootPart.Position).Magnitude <= 2 then creep.Humanoid.WalkSpeed = dfws / 2.5 if db == false then db = true creep.Head.Slash:Play() if slashanim.Value == 1 then creep.Humanoid:LoadAnimation(script.Slash1):Play() slashanim.Value = 2 elseif slashanim.Value == 2 then creep.Humanoid:LoadAnimation(script.Slash2):Play() slashanim.Value = 1 end if math.random(0,enemycreep.MissChance.Value) <= enemycreep.MissChance.Value / 25 then if enemycreep:FindFirstChild("invincibility").Value == false then enemycreep.Humanoid:TakeDamage(dps) end wait(atkspeed) db = false end end else creep.Humanoid.WalkSpeed = dfws end if enemycreep.Humanoid.Health <= 0 then local cs = script:Clone() cs.Parent = script.Parent for i, v in pairs(creep.Humanoid.Animator:GetPlayingAnimationTracks()) do if v.Name == "Slash1" or v.Name == "Slash2" then v:Stop() end end script:Destroy() end else return end end
local function attackTower(creep, tower) if tower.Faction.Value ~= creep.Faction.Value then if tower.Health.Value > 0 and creep.Humanoid.Health > 0 then fighting = true waypoints = {} creep.Humanoid:MoveTo(tower.BasePart.Position) if (creep.HumanoidRootPart.Position - tower.BasePart.Position).Magnitude <= 7 then creep.Humanoid.WalkSpeed = dfws / 2.5 if db == false then db = true creep.Head.Slash:Play() if slashanim.Value == 1 then creep.Humanoid:LoadAnimation(script.Slash1):Play() slashanim.Value = 2 elseif slashanim.Value == 2 then creep.Humanoid:LoadAnimation(script.Slash2):Play() slashanim.Value = 1 end if tower:FindFirstChild("invincibility").Value == false then tower.Health.Value = tower.Health.Value - (dps / 1.2) end wait(atkspeed) db = false end
codeelse creep.Humanoid.WalkSpeed = dfws end if tower.Health.Value <= 0 then local cs = script:Clone() cs.Parent = script.Parent for i, v in pairs(creep.Humanoid.Animator:GetPlayingAnimationTracks()) do if v.Name == "Slash1" or v.Name == "Slash2" then v:Stop() end end script:Destroy() end else return end end - Assistant
Ошибка возникает, потому что поле "ReachedPos" является экземпляром класса "IntValue", который находится в объекте "CreepTop", а не в объекте "Script". Чтобы исправить это, вы должны использовать объект "CreepTop" для доступа к полю "ReachedPos". Например:
if script.Parent.Name == "DireCreep" then for _, creep in ipairs(targetCreepListDire) do Lane(script.Parent, targetCreepListDire, game.Workspace.RadiantAncient, enemyTowersRadiant) end else for _, creep in ipairs(targetCreepListRadiant) do Lane(script.Parent, targetCreepListRadiant, game.Workspace.DireAncient, enemyTowersDire) end end