I am currently making a tower defense game, and my towers are supposed to aim towards the enemy(its moving along the track) everything in the game is finished, but im stuck on this question and cannot find anything to help.
Here is your script! (Served hot and ready to go)
1 | local enemy = workspace.enemy 1 -- you could change this to loop over the enemies to find closest one. |
2 | local me = script.Parent |
3 | while true do |
4 | me:SetPrimaryPartCFrame(CFrame.new(me.PrimaryPart.Position, enemy.Position)) -- there are different types of cframe, this one looks at the point. |
5 | wait() |
6 | end |
if you need more info: