Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local FillColor = Color3.fromRGB(175,25,255)
- local DepthMode = "AlwaysOnTop"
- local FillTransparency = 0.5
- local OutlineColor = Color3.fromRGB(255,255,255)
- local OutlineTransparency = 0
- local CoreGui = game:FindService("CoreGui")
- local Players = game:FindService("Players")
- local lp = Players.LocalPlayer
- local connections = {}
- local Storage = Instance.new("Folder")
- Storage.Parent = CoreGui
- Storage.Name = "Highlight_Storage"
- local function Highlight(plr)
- local Highlight = Instance.new("Highlight")
- Highlight.Name = plr.Name
- Highlight.FillColor = FillColor
- Highlight.DepthMode = DepthMode
- Highlight.FillTransparency = FillTransparency
- Highlight.OutlineColor = OutlineColor
- Highlight.OutlineTransparency = 0
- Highlight.Parent = Storage
- local plrchar = plr.Character
- if plrchar then
- Highlight.Adornee = plrchar
- end
- connections[plr] = plr.CharacterAdded:Connect(function(char)
- Highlight.Adornee = char
- end)
- end
- Players.PlayerAdded:Connect(Highlight)
- for i,v in next, Players:GetPlayers() do
- Highlight(v)
- end
- Players.PlayerRemoving:Connect(function(plr)
- local plrname = plr.Name
- if Storage[plrname] then
- Storage[plrname]:Destroy()
- end
- if connections[plr] then
- connections[plr]:Disconnect()
- end
- end)
- -- settings
- local settings = {
- defaultcolor = Color3.fromRGB(255,0,0),
- teamcheck = false,
- teamcolor = true
- };
- -- services
- local runService = game:GetService("RunService");
- local players = game:GetService("Players");
- -- variables
- local localPlayer = players.LocalPlayer;
- local camera = workspace.CurrentCamera;
- -- functions
- local newVector2, newColor3, newDrawing = Vector2.new, Color3.new, Drawing.new;
- local tan, rad = math.tan, math.rad;
- local round = function(...) local a = {}; for i,v in next, table.pack(...) do a[i] = math.round(v); end return unpack(a); end;
- local wtvp = function(...) local a, b = camera.WorldToViewportPoint(camera, ...) return newVector2(a.X, a.Y), b, a.Z end;
- local espCache = {};
- local function createEsp(player)
- local drawings = {};
- drawings.box = newDrawing("Square");
- drawings.box.Thickness = 1;
- drawings.box.Filled = false;
- drawings.box.Color = settings.defaultcolor;
- drawings.box.Visible = false;
- drawings.box.ZIndex = 2;
- drawings.boxoutline = newDrawing("Square");
- drawings.boxoutline.Thickness = 3;
- drawings.boxoutline.Filled = false;
- drawings.boxoutline.Color = newColor3();
- drawings.boxoutline.Visible = false;
- drawings.boxoutline.ZIndex = 1;
- espCache[player] = drawings;
- end
- local function removeEsp(player)
- if rawget(espCache, player) then
- for _, drawing in next, espCache[player] do
- drawing:Remove();
- end
- espCache[player] = nil;
- end
- end
- local function updateEsp(player, esp)
- local character = player and player.Character;
- if character then
- local cframe = character:GetModelCFrame();
- local position, visible, depth = wtvp(cframe.Position);
- esp.box.Visible = visible;
- esp.boxoutline.Visible = visible;
- if cframe and visible then
- local scaleFactor = 1 / (depth * tan(rad(camera.FieldOfView / 2)) * 2) * 1000;
- local width, height = round(4 * scaleFactor, 5 * scaleFactor);
- local x, y = round(position.X, position.Y);
- esp.box.Size = newVector2(width, height);
- esp.box.Position = newVector2(round(x - width / 2, y - height / 2));
- esp.box.Color = settings.teamcolor and player.TeamColor.Color or settings.defaultcolor;
- esp.boxoutline.Size = esp.box.Size;
- esp.boxoutline.Position = esp.box.Position;
- end
- else
- esp.box.Visible = false;
- esp.boxoutline.Visible = false;
- end
- end
- -- main
- for _, player in next, players:GetPlayers() do
- if player ~= localPlayer then
- createEsp(player);
- end
- end
- players.PlayerAdded:Connect(function(player)
- createEsp(player);
- end);
- players.PlayerRemoving:Connect(function(player)
- removeEsp(player);
- end)
- runService:BindToRenderStep("esp", Enum.RenderPriority.Camera.Value, function()
- for player, drawings in next, espCache do
- if settings.teamcheck and player.Team == localPlayer.Team then
- continue;
- end
- if drawings and player ~= localPlayer then
- updateEsp(player, drawings);
- end
- end
- end)
- -- Custom Crosshair by zzerexx#3970
- getgenv().CrosshairSettings = {
- Color = Color3.fromRGB(255,0,0),
- RainbowColor = true,
- Opacity = 9,
- Length = 10,-- Length of each line
- Thickness = 2,-- Thickness of each line
- Offset = 4, -- Offset from the middle point
- Dot = true, -- not recommended
- FollowCursor = false, -- Crosshair follows the cursor
- HideMouseIcon = true, -- Hides the mouse icon, set to 0 to ignore
- HideGameCrosshair = true, -- Hides the current game's crosshair (if its supported)
- ToggleKey = Enum.KeyCode.RightAlt, -- Toggles crosshair visibility
- } -- v1.2.1
- loadstring(game:HttpGet("https://raw.githubusercontent.com/zzerexx/scripts/main/CustomCrosshair.lua", true))()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement