The title basically says it all lol
local Player game.Players:GetPlayers()
while true do
wait()
local Distance = Player:DistanceFromCharacter(game.Workspace.TowerHitbox.Position)
The title basically says it all lol
local Player game.Players:GetPlayers()
while true do
wait()
local Distance = Player:DistanceFromCharacter(game.Workspace.TowerHitbox.Position)
local Players = game:GetService("Players")
while true do
wait()
for _, player in pairs(Players:GetPlayers()) do
local distance = player:DistanceFromCharacter(workspace.TowerHitbox.Position)
--Rest of the code needed
end
end
You could also substitute wait()
with game:GetService("RunService").Heartbeat:Wait()
if you want it to ensure it fires per frame