Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I change the cursor of an item?

I've got some gear in my game, that has no crosshair image (it's just the blue circle thing). How do I change the crosshair for the gear?

2 answers

The crosshair for any gear you see in a game, is actually just a custom mouse.Icon. The Icon Property of the mouse is whatever your cursor will show up as(:

So to edit the crosshairs of a gear, simply edit the mouse's Icon.

Example;

local template = 'rbxassetid://' --The template for the icon
local icon = '0000000' --The actual ID to set your icon as
local default = '' --The default icon for the mouse
local tool = script.Parent --The tool

--When the tool is equipped
script.Parent.Equipped:connect(function(mouse)
	--Set the icon
	mouse.Icon = template..icon
	--When the tool is unequipped
	script.Parent.Unequipped:connect(function()
		--Revert the icon
		mouse.Icon = template..default
	end)
end)

(NOTE) The mouse's Icon can only be set from a localscript!

1 comment

0

OK, thanks. This helps alot :)

Just as an additional thing, what do you mean by a "template"?

4 comments

0

In the future, just comment on my answer.. don't make another answer. And by template i mean the base for the ID. The ID is always going to have rbxassetid:// in it for it to be an ID. Look at decals - they don't only have the ID number, there's the 'template' there too. It's hard to explain but it's an essential for setting the ID.

0

oh, ok. thanks. i'm new here.

0

is the template like this? Crosshair-item?id=96343638

0

No, that's part of the URL for the actual Decal. You see those numbers on the end? Those are the ID for the decal, the template just always comes before the ID(: So you would go 'rbxassetid://96343638' if you wanted to use that.. or in the code I provided just replace the 'icon' value with '96343638'.

This discussion is preserved as it was. New answers, comments, and votes are closed.