Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to change mouse icon for everything?

Asked by 3 years ago

I'm trying to change the mouse icon in my game, but when I hover my mouse over a gui, it changes to a different one.

The code I use is:

local player = game.Players.LocalPlayer
local mouse = player:GetMouse()

mouse.Icon = 'http://www.roblox.com/asset/?id=5512887231'

1 answer

Log in to vote
0
Answered by 3 years ago
Edited 3 years ago

Yes While the cursor hovers over a GuiButton, this property is temporarily ignored

A solution could be to create a custom mouse gui

Use this

local Player = game:GetService("Players").LocalPlayer
local PlayerGui = Player:WaitForChild("PlayerGui")
local RunService = game:GetService("RunService")
local UserInput = game:GetService("UserInputService")

local ScreenGui = Instance.new("ScreenGui",PlayerGui)
local Cursor = Instance.new("ImageLabel",ScreenGui)

ScreenGui.Enabled = true
ScreenGui.ResetOnSpawn = false
ScreenGui.IgnoreGuiInset = true
ScreenGui.DisplayOrder = 9999

Cursor.Visible = true
Cursor.Size = UDim2.fromOffset(50,50) --Mouse icon size
Cursor.BackgroundTransparency = 1
Cursor.Image = "http://www.roblox.com/asset/?id=5512887231" --Assed ID
Cursor.AnchorPoint = Vector2.new(0.5,0.5) --Change for the image position
UserInput.MouseIconEnabled = false --Disable mouse icon
RunService.RenderStepped:Connect(function()
    local MousePos = UserInput:GetMouseLocation()
    UserInput.MouseIconEnabled = false --just to be sure xd
    Cursor.Position = UDim2.fromOffset(MousePos.X,MousePos.Y)
end)
0
Too much work if i'm going to have to change it for all my guys. I'm just not going to change icon. But i'm accepting anyways. Bin_Latin 2 — 3y
Ad

Answer this question