How can I change this script?

So I have a Roblox’s classic sword and I’m making it more simplified to make it easier in the future to make changes. But, because I changed the normal script it seems the mouse script won’t work. The normal cross hair works, but when I click it doesn’t change the mouse icon to reloading like it should.
How do I do this? For me it’s very hard to understand.
The Script:

--Made by Luckymaxer

Mouse_Icon = "rbxasset://textures/GunCursor.png"

Reloading_Icon = "rbxasset://textures/GunWaitCursor.png"

Tool = script.Parent

Mouse = nil

function UpdateIcon()

if Mouse then

Mouse.Icon = Tool.Enabled and Mouse_Icon or Reloading_Icon

end

end

function OnEquipped(ToolMouse)

Mouse = ToolMouse

UpdateIcon()

end

function OnChanged(Property)

if Property == "Enabled" then

UpdateIcon()

end

end

Thank you.
–SilentSuprion

Mouse_Icon = "rbxasset://textures/GunCursor.png"
Reloading_Icon = "rbxasset://textures/GunWaitCursor.png"
Normal = "rbxasset://SystemCursors/Arrow"
tool = script.Parent

local mouse = game.Players.LocalPlayer:GetMouse()
tool.Equipped:Connect(function()
	mouse.Icon = Mouse_Icon --when it's equipped icon changes to cursor
end)

local debounce = false
tool.Activated:Connect(function()
	if not debounce then
		debounce = true
		mouse.Icon = Reloading_Icon --reload icon
		wait(0.5) --gives attack a cooldown
		mouse.Icon = Mouse_Icon --icon back to cursor
		debounce = false
	end
end)
tool.Unequipped:Connect(function()
	mouse.Icon = Normal -- changes mouse back to normal
end)
2 Likes

The way this code works is by updating the icon whenever the tool’s .Enabled property is updated. Consider adding a listener for when the tool is activated.