Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local LatestRoom = game.ReplicatedStorage.GameData.LatestRoom
- local ESP = false
- local Character = game.Players.LocalPlayer.Character
- LatestRoom:GetPropertyChangedSignal("Value"):Connect(function(value)
- ESP = value
- updateESP()
- end)
- function updateESP()
- local RoomNumber = math.clamp(LatestRoom.Value, 0, 99)
- local HighlightParent = workspace.CurrentRooms[tostring(RoomNumber)].Door.Door
- local HighlightChild = HighlightParent:FindFirstChild("DoorESP_Highlight")
- if not HighlightChild then
- HighlightChild = Instance.new("Highlight")
- HighlightChild.Name = "DoorESP_Highlight"
- HighlightChild.Parent = HighlightParent
- HighlightChild.DepthMode = Enum.HighlightDepthMode.AlwaysOnTop
- end
- local BillboardGui = HighlightParent:FindFirstChild("DoorESP_BillboardGui")
- if not BillboardGui then
- BillboardGui = Instance.new("BillboardGui")
- BillboardGui.Adornee = HighlightParent
- BillboardGui.Name = "DoorESP_BillboardGui"
- BillboardGui.AlwaysOnTop = true
- BillboardGui.Size = UDim2.new(0, 200, 0, 50)
- BillboardGui.StudsOffset = Vector3.new(0, 3, 0)
- BillboardGui.Parent = HighlightParent
- end
- local TextLabel = BillboardGui:FindFirstChild("TextLabel")
- if not TextLabel then
- TextLabel = Instance.new("TextLabel")
- TextLabel.Name = DoorESP_TextLabel
- TextLabel.BackgroundTransparency = 1
- TextLabel.Size = UDim2.new(1, 0, 1, 0)
- TextLabel.TextColor3 = Color3.new(1, 1, 1)
- TextLabel.TextScaled = true
- TextLabel.Font = Enum.Font.GothamMedium
- TextLabel.Parent = BillboardGui
- end
- local function fixESP()
- if HighlightParent and HighlightChild and HighlightParent:IsDescendantOf(workspace) then
- local hue = (tick() % 5) / 5
- HighlightChild.FillColor = Color3.fromHSV(hue, 1, 1)
- HighlightChild.OutlineColor = Color3.fromHSV(hue, 1, 1)
- TextLabel.Text = "Door " .. tostring(math.floor(RoomNumber + 1)) .. " [" .. tostring(math.floor((workspace.CurrentRooms[tostring(RoomNumber)].Door.Door.Position - Character.HumanoidRootPart.Position).Magnitude + 0.5)) .. " m]"
- end
- end
- game:GetService("RunService").RenderStepped:Connect(fixESP)
- end
- if not ESP and Value then
- updateESP()
- end
- if ESP and not Value then
- workspace.CurrentRooms[tostring(RoomNumber)].Door.Door.DoorESP_Highlight:Destroy()
- workspace.CurrentRooms[tostring(RoomNumber)].Door.Door.DoorESP_BillboardGui:Destroy()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement