Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Is there a way to tell if the Mouse is Active?

So I have a script that positions a GUI on the screen according to the Mouse's X and Y position on the screen, but whenever I die, I always get an error that says "Mouse is no longer Active." Even though the error only comes when the player dies, I don't want any errors at all, so is there a way of telling if the Mouse is Active or not? Or would I have to do something else to get rid of this problem?

1 answer

Because the player's re-spawning causes the mouse to reset, you would have to reset the player's mouse value so I would suggest:

player.CharacterAdded:connect(function()
mouse = player:GetMouse()
end)

By adding this, the game SHOULD re-get the mouse and stop erring when your player spawns.

NOTE: THIS CODE IS NOT TESTED.

This discussion is preserved as it was. New answers, comments, and votes are closed.