#gnome code depricationmaxxing
1 messages · Page 1 of 1 (latest)
Watch bruh by saigonnz and millions of other Roblox Studio videos on Medal. #robloxstudio
nvm figured it out but now i got another problem
they also ignore pathfinding
what did you changed
the local targetPosition up to newtw:PivotTo
local rs = game:GetService("ReplicatedStorage")
local ss = game:GetService("ServerStorage")
local ev = rs:WaitForChild("Events")
local spawntw = ev:WaitForChild("SpawnTower")
local animtw = ev:WaitForChild("AnimateTower")
local tw = {}
function findnt(ntw)
local mdis = 50
local nt = nil
for i, t in ipairs(workspace.Mobs:GetChildren()) do
local dis = (t.HumanoidRootPart.Position - ntw.HumanoidRootPart.Position).Magnitude
if dis < mdis then
nt = t
mdis = dis
end
end
return nt
end
function tw.Attack(newtw)
local t = findnt(newtw)
if t and t:FindFirstChild("Humanoid") and t.Humanoid.Health > 0 then
-- this one
local targetPosition = t.HumanoidRootPart.Position
local towerPosition = newtw.PrimaryPart.Position
targetPosition = Vector3.new(targetPosition.X, towerPosition.Y, targetPosition.Z)
newtw:PivotTo(CFrame.lookAt(towerPosition, targetPosition))
-- up to here
animtw:FireAllClients(newtw, "Hit")
t.Humanoid:TakeDamage(1)
end
task.wait(1)
tw.Attack(newtw)
end
function tw.Spawn(plr, n, cf)
local tEx = rs.Towers:FindFirstChild(n)
if tEx then
local ntw = tEx:Clone()
ntw.HumanoidRootPart.CFrame = cf
ntw.Parent = workspace.Towers
ntw.HumanoidRootPart:SetNetworkOwner(nil)
for _, object in ipairs(ntw:GetDescendants()) do
if object:IsA("BasePart") then
object.CollisionGroup = "Tower"
end
end
coroutine.wrap(tw.Attack)(ntw)
else
warn("bro cant find:", n)
end
end
spawntw.OnServerEvent:Connect(tw.Spawn)
return tw
fixed it but now they start jumping (in the clip)
do not
use
gnomecode for
tower defense
its old and outdated
too much deprecated functions and stuff
idk