Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local UserInputService = game:GetService("UserInputService")
- local RunService = game:GetService("RunService")
- local Players = game:GetService("Players")
- local LocalPlayer = Players.LocalPlayer
- --protectui
- function protectUI(sGui)
- local function blankfunction(...)
- return ...
- end
- local cloneref = cloneref or blankfunction
- local function SafeGetService(service)
- return cloneref(game:GetService(service)) or game:GetService(service)
- end
- local cGUI = SafeGetService("CoreGui")
- local rPlr = SafeGetService("Players"):FindFirstChildWhichIsA("Player")
- local cGUIProtect = {}
- local rService = SafeGetService("RunService")
- local lPlr = SafeGetService("Players").LocalPlayer
- local function NAProtection(inst, var)
- if inst then
- if var then
- inst[var] = "\0"
- inst.Archivable = false
- else
- inst.Name = "\0"
- inst.Archivable = false
- end
- end
- end
- if (get_hidden_gui or gethui) then
- local hiddenUI = (get_hidden_gui or gethui)
- NAProtection(sGui)
- sGui.Parent = hiddenUI()
- return sGui
- elseif (not is_sirhurt_closure) and (syn and syn.protect_gui) then
- NAProtection(sGui)
- syn.protect_gui(sGui)
- sGui.Parent = cGUI
- return sGui
- elseif cGUI:FindFirstChildWhichIsA("ScreenGui") then
- pcall(function()
- for _, v in pairs(sGui:GetDescendants()) do
- cGUIProtect[v] = rPlr.Name
- end
- sGui.DescendantAdded:Connect(function(v)
- cGUIProtect[v] = rPlr.Name
- end)
- cGUIProtect[sGui] = rPlr.Name
- local meta = getrawmetatable(game)
- local tostr = meta.__tostring
- setreadonly(meta, false)
- meta.__tostring = newcclosure(function(t)
- if cGUIProtect[t] and not checkcaller() then
- return cGUIProtect[t]
- end
- return tostr(t)
- end)
- end)
- if not rService:IsStudio() then
- local newGui = cGUI:FindFirstChildWhichIsA("ScreenGui")
- newGui.DescendantAdded:Connect(function(v)
- cGUIProtect[v] = rPlr.Name
- end)
- for _, v in pairs(sGui:GetChildren()) do
- v.Parent = newGui
- end
- sGui = newGui
- end
- return sGui
- elseif cGUI then
- NAProtection(sGui)
- sGui.Parent = cGUI
- return sGui
- elseif lPlr and lPlr:FindFirstChild("PlayerGui") then
- NAProtection(sGui)
- sGui.Parent = lPlr:FindFirstChild("PlayerGui")
- return sGui
- else
- return nil
- end
- end
- --getgenv settings
- getgenv().CustomCursorEnabled = getgenv().CustomCursorEnabled or false
- getgenv().imagesize = getgenv().imagesize or {46, 46}
- getgenv().imageid = getgenv().imageid or "id"
- local Cursor = Instance.new("ScreenGui")
- Cursor.Name = "CustomCursor"
- Cursor.IgnoreGuiInset = true
- Cursor.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
- Cursor.ResetOnSpawn = false
- protectUI(Cursor)
- local CursorImage = Instance.new("ImageLabel")
- CursorImage.Name = "CursorImage"
- CursorImage.AnchorPoint = Vector2.new(0.5, 0.5)
- CursorImage.BackgroundTransparency = 1
- CursorImage.Size = UDim2.fromOffset(getgenv().imagesize[1], getgenv().imagesize[2])
- CursorImage.Image = "http://www.roblox.com/asset/?id=" .. getgenv().imageid
- CursorImage.ZIndex = 999
- CursorImage.Visible = false
- CursorImage.Parent = Cursor
- local RenderConnection
- local function ToggleCustomCursor(enabled)
- getgenv().CustomCursorEnabled = enabled
- local oldMouseIcon = UserInputService.MouseIconEnabled
- if enabled then
- RenderConnection = RunService.RenderStepped:Connect(function()
- UserInputService.MouseIconEnabled = false
- local mouseLocation = UserInputService:GetMouseLocation()
- CursorImage.Position = UDim2.fromOffset(mouseLocation.X, mouseLocation.Y)
- CursorImage.Visible = true
- end)
- else
- if RenderConnection then
- RenderConnection:Disconnect()
- end
- UserInputService.MouseIconEnabled = oldMouseIcon
- CursorImage.Visible = false
- end
- end
- ToggleCustomCursor(getgenv().CustomCursorEnabled)
- getgenv().ToggleCustomCursor = ToggleCustomCursor
- return {
- Toggle = ToggleCustomCursor,
- Cursor = CursorImage
- }
Advertisement
Add Comment
Please, Sign In to add comment