Hello! I had made a script a bit ago that would change the default mouse cursor and clickdetector cursor icons in one script.
Here is my script that has failed to work now, as opposed to when it was first made.
local Players = game:GetService("Players")
local UserInputService = game:GetService("UserInputService")
local LocalPlayer = Players.LocalPlayer
local PlayerMouse = LocalPlayer:GetMouse()
UserInputService.InputChanged:Connect(function(InputObject, GameProcessedEvent)
if InputObject.UserInputType == Enum.UserInputType.MouseMovement and not GameProcessedEvent then
if PlayerMouse.Target and PlayerMouse.Target:FindFirstChildWhichIsA("ClickDetector") then
PlayerMouse.Icon = "http://www.roblox.com/asset/?id=12293208401"
else
PlayerMouse.Icon = "http://www.roblox.com/asset/?id=12293207026"
end
end
end)
2 Likes
Man Imma be Honest with you Its pretty easy To create a custom mouse cursor and a custom click detector cursor, you can use a combination of the Mouse
and UserInputService
services. hERE Is a WAY you can do this:
- Create a
ScreenGui
object in the StarterGui
. Rename it to “CustomCursorGui” (or any desired name:)).
- Inside the “CustomCursorGui” ScreenGui, create an
ImageLabel
object. This will be your custom mouse cursor. Customize it by setting its Size
, Position
, Image
, and other properties according to your design preferences.
- Create another
ImageLabel
object Inside the “CustomCursorGui” ScreenGui. This Is Gonna be your custom click detector cursor. Customize it similarly to the custom mouse cursor(By this I mean the Size and Position and etc), but give it a different image or design to differentiate it from the regular cursor.
- In a Script, parented to the “CustomCursorGui” ScreenGui, write the following code or you can customize it or whatever its your choice :
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local cursorGui = script.Parent
-- Hide default cursor
mouse.Icon = "rbxasset://textures\\ArrowCursor.png"
-- Update cursor position
mouse.Move:Connect(function()
cursorGui.ImageLabel.Position = UDim2.new(0, mouse.X, 0, mouse.Y)
end)
-- Show custom cursor
cursorGui.ImageLabel.Visible = true
-- Hide custom click detector cursor initially
cursorGui.CustomClickDetectorCursor.Visible = false
-- Show custom click detector cursor on mouse click
mouse.Button1Down:Connect(function()
cursorGui.ImageLabel.Visible = false
cursorGui.CustomClickDetectorCursor.Visible = true
end)
-- Hide custom click detector cursor on mouse release
mouse.Button1Up:Connect(function()
cursorGui.ImageLabel.Visible = true
cursorGui.CustomClickDetectorCursor.Visible = false
end)
SRRY I was in a rush writing this and i hope my comments in tyhe script helps you understand the code if you dont
I hope this helps you a lot my G
4 Likes