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

Help with Mouse and GUIs?

My question is, When I have a GUI Frame, and I want to use MouseWheelForward, How do I make it fire the MouseWheelForward event, Without Scrolling in on the Player's Character? For Example:

script.Parent.Parent.Frame.MouseWheelForward:connect(function()
print("He is going forward")
end)

It would do the print just fine, But at the same time, It would be moving my Camera closer to my character, Whacking the whole thing up.

Answers would be gladly appreciated.

1 answer

✓ Accepted answer

Specifying the frame as Active blocks all mouse actions from doing anything the ROBLOX way (but will still trigger the events). (This is equivalent to the behavior of using a TextButton instead of a Frame)

If you still want to be able to click through, you can only momentarily turn the Frame to Active upon scrolling, like this:

script.Parent.MouseWheelBackward:connect(function()
	script.Parent.Active = true;
	wait(0.03);
	script.Parent.Active = false;
end);

3 comments

0

Thanks man.

0

I have to ask. Why do scriptwriters put ";" in the code? It does no effect, and you don't need it.

0

1518NICENICEKEY: Sometimes, it is required. Since that comes up, I dislike very much the inconsistency of not using it elsewhere. It also lets me more clearly mark when I have actually finished thinking about a line (like a period in natural language). Finally, it makes it much easier for me to switch between styles for Lua and JavaScript/C/Java

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