Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How would make a tower defense tower that can detect enemies in a range and damage them?

Asked by 4 years ago
Edited 4 years ago

Sorry to bug you guys with out any script or guidelines, but this is the general idea. Get the nearest enemy(10 studs?) and do damage to them. Maybe rotate to face them to? Thanks for all your guys help on my last question.

local rx = enemy:getloc(x) -- pseudo code
local ry = enemy:getloc(y) -- pseudo code
local mx = script.Parent:getloc(x) -- pseudo code
local my = script.Parent:getloc(y) -- pseudo code
local mathx = rx - mx
local mathy = ry - my
local aim = math.atan(mathy / mathx)
--cframe stuff
--damage stuff

Would this be sorf of aiming?

0
for the detection use magnitude and damage the players in the area and for the rotating to it use bodygyro IcyMizu 122 — 4y
0
What? sorry im kind of new to scripting and that script is just a pseudo code script marine5575 359 — 4y
0
Thanks for all your help! marine5575 359 — 4y

Answer this question