Help with tweening the mouse cursor

I can’t figure out how to make the mouse icon rotate with tweens!

So basically I want my cursor to rotate and fade in when a tool is equipped. Tried using tweens and tried rotating an image label, no luck.

Mouse_Icon = "rbxassetid://1587962705"

Tool = script.Parent

Mouse = nil

function UpdateIcon()
	if Mouse then
		Mouse.Icon = Tool.Enabled and Mouse_Icon
	end
end

function OnEquipped(ToolMouse)
	Mouse = ToolMouse
	UpdateIcon()
end

function OnChanged(Property)
	if Property == "Enabled" then
		UpdateIcon()
	end
end

Tool.Equipped:Connect(OnEquipped)
Tool.Changed:Connect(OnChanged)

This is my current script right now. A LocalScript stored inside my tool.
image

2 Likes

Here are some articles:

If you need a YouTube video I highly recommend this one: Roblox GUI Scripting Tutorial #5 - Tweening GUI (Beginner to Pro 2020) - YouTube

1 Like

You can’t rotate or re-position the mouse icon through the Mouse instance. To achieve what you want, you will need to make the real mouse invisible, and then create a GUI that follows the mouse’s location, and then do the tween/rotate effects to the GUI.

1 Like

I used a while true do loop to make a frame go to my mouse but it’s really choppy. How do I fix this?

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

while true do
ㅤwait()
ㅤscript.Parent.Position = UDim2.new(0, ((mouse.X)-0), 0, ((mouse.Y)-0))
end

while true do is not a good way to do this. Instead, try

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

mouse.Move:Connect(function()
ㅤscript.Parent.Position = UDim2.new(0, ((mouse.X)-0), 0, ((mouse.Y)-0))
end)
3 Likes

Ok, i made the thing where it changes my cursor to the image i want, i’ll continue on this tommorow

2 Likes

Thank you all for helping! My problem was solved!

3 Likes

although i dont know who to mark as solution .-.

2 Likes