Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

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

Asked by 10 years ago

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

Log in to vote
0
Answered by
RedCombee 585 Moderation Voter
10 years ago

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.

Ad

Answer this question