Cursor Script not working due to Roblox Cursor

Hi!

I made this script earlier to get around the stupid Roblox incapibility, which is to not have a Custom Mouse HoverOver image. Really annoying. If any Roblox staff see this, please add that!

But anyways, my script isn’t working, with no error.

What’s wrong?

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

mouse.Icon = "http://www.roblox.com/asset/?id=7027810711"

while wait (0.1) do
	local t = script.Parent:GetDescendants()

	for _, instance in pairs(t) do

		if instance:IsA("ImageButton") then
			instance.MouseEnter:Connect(function()
				mouse.Icon = "http://www.roblox.com/asset/?id=7027845989"
			end)
			instance.MouseLeave:Connect(function()
				mouse.Icon = "http://www.roblox.com/asset/?id=7027810711"
			end)
			elseif instance:IsA("ImageButton") then
				instance.MouseEnter:Connect(function()
					mouse.Icon = "http://www.roblox.com/asset/?id=7027845989"
				end)
				instance.MouseLeave:Connect(function()
					mouse.Icon = "http://www.roblox.com/asset/?id=7027810711"
				end)
		end



	end

end

What’s wrong there? Thanks!

Video:

(pressed multiple buttons to prove it wan’t defective on only one)
No errors

3 Likes

Please don’t play music like that in the video.

Anyways, that’s first because those buttons are TextButtons, not ImageButtons.

Second of all, having a loop that makes a Connection with every Image button in the script’s Parent’s descendants 10 times a second is not a good idea.

You should wait for the buttons you want connected using WaitForChild, then connect them.

Example:

local Buttons= {
	[path using WaitForChild],
	[path using WaitForChild],
--etc
}

for _,instance in pairs(Buttons) do
	instance.MouseEnter:Connect(function()
		mouse.Icon = "http://www.roblox.com/asset/?id=7027845989"
	end)
	instance.MouseLeave:Connect(function()
		mouse.Icon = "http://www.roblox.com/asset/?id=7027810711"
	end)
end

Oh, i’m dumb, and I made both the instances ImageButtons.


(i muted it, happy?)

But anyways, it still wont work.

Do you have an example with your second suggestion?

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

mouse.Icon = "http://www.roblox.com/asset/?id=7027810711"

while wait (0.1) do
	local t = script.Parent:GetDescendants()

	for _, instance in pairs(t) do

		if instance:IsA("ImageButton") then
			instance.MouseEnter:Connect(function()
				mouse.Icon = "http://www.roblox.com/asset/?id=7027845989"
			end)
			instance.MouseLeave:Connect(function()
				mouse.Icon = "http://www.roblox.com/asset/?id=7027810711"
			end)
			elseif instance:IsA("TextButton") then
				instance.MouseEnter:Connect(function()
					mouse.Icon = "http://www.roblox.com/asset/?id=7027845989"
				end)
				instance.MouseLeave:Connect(function()
					mouse.Icon = "http://www.roblox.com/asset/?id=7027810711"
				end)
		end



	end

end
1 Like

30 minutes is when i try to push lol

Anybody have anything on this?

It’s been over an hour, and nothing.

Anybody have any idea?

Why are you using a while loop? You don’t need to create a new connection every 0.1 seconds.

Removed that, still wont work.

Add print to those events, is it printed?


Yes.

Then, the image id must be wrong id

Take the mouse images, put them in a decal, wait a few seconds, the image should be a few numbers different, paste the new number where you had the old ones. I’m 99.9% sure theres a better method for that though, just never got around to figuring it out.

It’s not, I checked.

It’s not the images, they are all correct!

They updated something to do with assets a while ago where using the asset ID in the URL doesnt work anymore, see if my method helps.

image
Could it be interfering with the Roblox default?

Probably it’s right. Add wait() in every single event

1 Like

Shouldn’t happen, but I dont see anything wrong with your code so I’m pretty sure you’re using invalid asset IDs.

1 Like


I narrowed it down. It’s interference.

@Bug-Support
This is more of a bug right now.

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

mouse.Icon = "rbxassetid://7027810711"


	local t = script.Parent:GetDescendants()

	for _, instance in pairs(t) do

		if instance:IsA("ImageButton") then
		instance.MouseEnter:Connect(function()
			wait()
				mouse.Icon = "rbxassetid://7027845989"
			end)
		instance.MouseLeave:Connect(function()
			wait()
				mouse.Icon = "rbxassetid://7027810711"
			end)
			elseif instance:IsA("TextButton") then
		instance.MouseEnter:Connect(function()
			wait(0.1)
					mouse.Icon = "rbxassetid://7027845989"
				end)
		instance.MouseLeave:Connect(function()
			wait(0.1)
					mouse.Icon = "rbxassetid://7027810711"
			end)
		end
	end

What it SHOULD be doing, is setting the Player’s Mouse ID to a click, but it’s instead pulling it locally.