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

Is there a way to reset the default mouse cursor?

I'm making a custom clickdetector script, and I'm changing the mouse icon to the ROBLOX one for clickdetectors whenever a certain part is under the mouse. However, I want the mouse to function normally after the mouse's target is no longer the brick. How can achieve this? My current code:

mouse.Move:connect(function()
	if player.Character.Humanoid.Health ~= 0 then
		if mouse.Target then
			local target = mouse.Target
			if target:IsDescendantOf(parts) then
				print(target)
				if mouse.Icon ~= "http://www.roblox.com/asset/?id=433782737" then
					mouse.Icon = "http://www.roblox.com/asset/?id=433782737"
				end
			elseif not target:IsDescendantOf(parts) then
				--mouse.Icon
			end	
		end
	end
end)

Thanks in advance.

1 answer

✓ Accepted answer

All you have to do is set mouse.Icon to an empty string:

mouse.Move:connect(function()
    if player.Character.Humanoid.Health ~= 0 then
        if mouse.Target then
            local target = mouse.Target
            if target:IsDescendantOf(parts) then
                print(target)
                if mouse.Icon ~= "http://www.roblox.com/asset/?id=433782737" then
                    mouse.Icon = "http://www.roblox.com/asset/?id=433782737"
                end
            elseif not target:IsDescendantOf(parts) then
                mouse.Icon = ""
            end 
        end
    end
end)

Hope this helped.

2 comments

0

Thanks!

0

No problem.

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