Currently handling this script with OnServerEvent, basically prints anything with a humanoid in it that its also a model, however itll keep printing constantly, im trying to make a “blacklist” so the same player doesnt get printed and rather skips over it but im unsure of how to do that.
local zoneTouch = zone.Touched:Connect(function(touched)
local touchedModel = touched:FindFirstAncestorOfClass('Model')
if touchedModel ~= nil then
if character ~= touchedModel then
for _, object in touchedModel:GetChildren() do
if object:IsA('Humanoid') then
remoteScan:FireClient(player, touchedModel)
end
end
end
end
end)
Entire Script:
--//Locals
local CollectionService = game:GetService("CollectionService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Mechanics = ReplicatedStorage:WaitForChild('Mechanics')
local RemoteEvents = ReplicatedStorage:WaitForChild('RemoteEvents')
local TweenService = game:GetService("TweenService")
--//Paths
local remoteScan = RemoteEvents:WaitForChild('remoteScan')
--//
--//Client To Server
local function onScanRequest(player, timer, debounce)
task.spawn(function()
if not debounce then
--// Paths
local scanner = Mechanics:WaitForChild('ScanZone')
local zone = scanner:Clone()
local light = zone:WaitForChild("PointLight")
local weld = Instance.new('WeldConstraint')
local character = player.Character
local HRP = character:FindFirstChild('HumanoidRootPart')
--//
--// Values
local zoneSizeStart = Vector3.new(0,0,0)
local zoneSize = Vector3.new(200,200,200)
--//
--// Default Settings
weld.Parent = zone
weld.Part0 = zone
weld.Part1 = HRP
zone.Size = zoneSizeStart
zone.Position = HRP.Position
zone.Parent = workspace
light.Range = 0
--//
--// Reusable Tween function
local function onTween(changes, cooldown, reverse, object)
local tweenInfo = TweenInfo.new(
cooldown, -- Time taken for a full animation
Enum.EasingStyle.Linear, -- Animation Style
Enum.EasingDirection.InOut, -- Animation Type
0, -- Number of repeats (-1 is infinite)
reverse, -- Reverse?
0 -- Delay between animations
)
local tween = TweenService:Create(object, tweenInfo, changes)
tween:Play()
end
--//
--// LocalPlayer is now scanning
zone.Size = zoneSizeStart
zone.Transparency = 0
light.Range = 0
light.Color = Color3.fromRGB(255, 255, 255)
local zoneChanges = {
Size = zoneSize;
Transparency = 1
}
onTween(zoneChanges, timer, false, zone)
local lightChanges = {
Range = 160;
Color = Color3.fromRGB(0, 0, 0)
}
onTween(lightChanges, timer*1.5, false, light)
local zoneTouch = zone.Touched:Connect(function(touched)
local touchedModel = touched:FindFirstAncestorOfClass('Model')
if touchedModel ~= nil then
if character ~= touchedModel then
for _, object in touchedModel:GetChildren() do
if object:IsA('Humanoid') then
remoteScan:FireClient(player, touchedModel)
end
end
end
end
end)
task.wait(timer)
zone:Destroy()
zoneTouch:Disconnect()
zoneTouch = nil
zone = nil
end
--//
end)
end
--//
--//Function Callers
remoteScan.OnServerEvent:Connect(onScanRequest)
--//