New default cursor freezing players when using a sword

Hey! I am a developer for a sword clan, and ever since these new cursors were added today, the swords are freezing, and sometimes crashing our players!

To be clear, I have little to no scripting experience, so I do not understand 90% of this script.

The error message is as follows:

Our script which is flagged in the error is as follows:

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

Tool.Activated:connect(function()
if not(Tool:FindFirstChild'Handle'.Size == script.Parent.Flush.Value)then
while true do end
end
end)

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

For reference the “while true do end” is line 26 as shown in the error.

Thank you for reading!

In this case, the while true do end is the issue. It can cause a script timeout or possible crash as you’ve seen. It doesn’t appear to be doing anything in this case so I would assume you could remove it.

Whether you remove it or not (it doesn’t look to be a completed script), the new mouse cursor has nothing to do with this issue.

Thank you for the reply! I have actually just checked against another sword that is the same, just recoloured, it is working, and the scripts are identical - could it perhaps be using a colon in the name or something?

From what I see here, the body of the while statement is empty. Is it possible you have the little tab near the line numbers closed? This would hide code within the while statement.

No, no code was hidden - just removed the while true do and it worked, thanks for the help!