Why the second icon does not load?

I am making cursor style for my game and when it detects a given heartbeat value, it switches the icon to a loading one, but that one does not load, leading to this:

local mouse = game.Players.LocalPlayer:GetMouse()
while true do
	wait()
	local Heartbeat = game:GetService("RunService").Heartbeat:Wait()
	if Heartbeat >= 0.016 then
		mouse.Icon = "http://www.roblox.com/asset/?id=15648791102"
	else
		mouse.Icon = "http://www.roblox.com/asset/?id=15648431915"
	end
end

Use “rbxassetid://id” instead of the roblox asset website

if Heartbeat >= 0.016 then
		mouse.Icon = "rbxassetid://15648791102"
	else
		mouse.Icon = "rbxassetid://15648431915"
	end

It still does it:

local mouse = game.Players.LocalPlayer:GetMouse()
while true do
	wait()
	local Heartbeat = game:GetService("RunService").Heartbeat:Wait()
	if Heartbeat >= 0.016 then
		mouse.Icon = "rbxassetid://15648791102"
	else
		mouse.Icon = "rbxassetid://15648431915"
	end
end

Sometimes the id changes, I put it in a decal and this is the right ID for your second mouse cursor:

15648791060

Instead of using game:GetService("RunService").Heartbeat:Wait() , you should connect to the Heartbeat event.

local mouse = game.Players.LocalPlayer:GetMouse()
local RunService = game:GetService("RunService")

local function updateMouseIcon()
	if RunService.Heartbeat >= 0.016 then
		mouse.Icon = "http://www.roblox.com/asset/?id=15648791102"
	else
		mouse.Icon = "http://www.roblox.com/asset/?id=15648431915"
	end
end

RunService.Heartbeat:Connect(updateMouseIcon)

while true do
	wait()
	updateMouseIcon()
end

I’ve created a function called updateMouseIcon that sets the mouse icon based on the Heartbeat value. I then connect this function to the Heartbeat event using RunService.Heartbeat:Connect(updateMouseIcon) . Finally, the updateMouseIcon function is called both within the event handler and outside the loop to ensure the mouse icon is updated continuously.

1 Like

Now it works as intended! Thank you for the information!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.