roblox revealing entities so I canot be lonely
🧩 Syntax:
--- Once again my PC shut off at home so I can't test this... oh well at least I can type ideas down.
local Player = game.Players.LocalPlayer
local Char = Player.Character
---Services
local InputService = game:GetService("UserInputService")
---Deboucnes
local RevealDB = false
--Highlightstats
local HighlightDuration = 5
local HighlightColor = Color3.New(0,0,0) -- basic white color
local function RevealAllEntities()
RevealDB = true
local Highlights = {}
for i, NewChar in pairs(game.WorkSpace:GetChildren()) do
if NewChar:FindFirstChild("Humanoid") ~= nil and NewChar.Name ~= Char.Name then
if NewChar.Humanoid.Health > 0 then -- if statements to see if they should be detected
local Highlight = Instance.new("Highlight",NewChar)
Highlight.OutlineColor = HighlightColor
table.Insert(HighlightedChars, Highlight)
NewChar.Humanoid.Died:Connect(function()
if Highlight.Parent ~= nil then Highlight:Destroy() end
end)
end
end
task.wait(HighlightDuration)
if #Highlights > 0 then
for i, Highlight in Pairs(Highlights) do
if Highlight.Parent ~= nil then Highlight:Destroy() end
end
end
RevealDB = false
end
-- tbh I'd prefer making it a client event but here's a basic input use for it
InputService.InputBegan:Connect(function(input, GameProcessed)
if not GameProcessed then
if input.Keycode == Enum.Keycode.F and RevealDB == false then
RevealAllEntities()
end
end
end)