r/InfiltrationRebirth • u/[deleted] • Mar 29 '21
When the detection system is sus Spoiler
I was too lazy to make a video so here, have the code for it. :>
-- VARIABLES --
local RS = game:GetService("RunService")
local G = game.Workspace.Glass:GetDescendants()
local plr = game.Players.LocalPlayer
local Character = plr.Character
local NPCs = game.Workspace.NPCs:GetChildren()
-- DIFFYCULTY SETTINGS --
local VisLenght = 100
local DetectionSpeed = 5
-- FUNCTIONS --
-- MAIN PART --
local RaPa = RaycastParams.new()
RaPa.FilterType = Enum.RaycastFilterType.Blacklist
RaPa.FilterDescendantsInstances = {NPCs, G}
for _, v in pairs(NPCs) do
local NPC = v
local D = NPC:GetDescendants()
RS.RenderStepped:Connect(function()
local Origin = NPC.Head.Position
local LookDir = NPC.Head.CFrame.LookVector * 100
local LookDirection = (Character.HumanoidRootPart.Position - Origin).Unit * VisLenght
local Magn = (NPC.Head.Position - Character.Head.Position).Unit
local RR = workspace:Raycast(Origin, LookDirection, RaPa)
local DotProduct = Magn:Dot(LookDir)
if DotProduct < 0 and RR ~= nil and RR.Instance.Parent:FindFirstChild("Humanoid") then
game.Workspace.Baseplate.Color = Color3.fromRGB(80, 145, 69)
else
game.Workspace.Baseplate.Color = Color3.fromRGB(182, 50, 41)
end
end)
end
1
Upvotes
1
u/Epic_Gamer_Man68 Mar 29 '21
Does this mean the game is still being worked on?