Help with radius system

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I want to achieve a radius system like the one of 3008 (the whistle thingy)

  2. What is the issue? Include screenshots / videos if possible!
    The issue is that i don’t know how to check if someone touched the radius to highlight the player like in 3008.

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I tried searching in dev hub, but i don’t find anything and i searched on youtube, but i can’t find on it either.

Here’s my code:

Client:

local UIS = game:GetService("UserInputService")
local Character = script.Parent
local Radius = game:GetService("ReplicatedStorage").Radius
local WhistleSound = script:WaitForChild("Whistle")
local TS = game:GetService("TweenService")
local DB = false
local Cooldown = 10
local CheckIfPlayersTouched = game.ReplicatedStorage.CheckIfPlayersTouched

UIS.InputBegan:Connect(function(input, gameproccesed)
	if gameproccesed then return end
	
	if input.KeyCode == Enum.KeyCode.H and DB == false then
		local RadiusClone = Radius:Clone()
		local RadiusTS = TS:Create(RadiusClone, TweenInfo.new(0.5), {Size = Vector3.new(120.018, 120.018, 120.018)})
		RadiusTS:Play()
		DB = true
		
		CheckIfPlayersTouched:FireServer(RadiusClone)
		WhistleSound:Play()
		RadiusClone.Parent = workspace
		RadiusClone.CFrame = Character.HumanoidRootPart.CFrame
		RadiusClone.CanCollide = false
		RadiusClone.Anchored = true
		RadiusTS.Completed:Connect(function()
			RadiusClone:Destroy()
		end)
		wait(Cooldown)
		DB = false
	end
end)

I’m working on the server so i’m not gonna show it.

Updated Script:

local UIS = game:GetService("UserInputService")
local Player = game.Players.LocalPlayer
local Character = script.Parent
local Radius = game:GetService("ReplicatedStorage").Radius
local WhistleSound = script:WaitForChild("Whistle")
local TS = game:GetService("TweenService")
local DB = false
local Cooldown = 7

UIS.InputBegan:Connect(function(input, gameproccesed)
	if gameproccesed then return end
	
	if input.KeyCode == Enum.KeyCode.H and DB == false then
		local RadiusClone = Radius:Clone()
		local RadiusTS = TS:Create(RadiusClone, TweenInfo.new(0.5), {Size = Vector3.new(120.018, 120.018, 120.018)})
		RadiusTS:Play()
		DB = true
		
		WhistleSound:Play()
		RadiusClone.Parent = workspace
		RadiusClone.CFrame = Character.HumanoidRootPart.CFrame
		RadiusClone.CanCollide = false
		RadiusClone.Anchored = true
		RadiusTS.Completed:Connect(function()
			RadiusClone:Destroy()
		end)
		for i, v in pairs(game.Players:GetChildren()) do
			RadiusClone.Touched:Connect(function()
				if v then
					local Highlight = Instance.new("Highlight")

					Highlight.Parent = v.Character
					task.wait(5)
					Highlight:Destroy()
				end
			end)
		end
		wait(Cooldown)
		DB = false
	end
end)

You could use .Magnitude, which provides a value of the distance between one part or another. If the magnitude is less than the length of the radius, do your code.

Could you give me a example code?

Edit: I’m trying to code my script again and it’s almost working! Thanks for trying to help.

Edit 2: It’s not working the way i wanted :((