Ad
Log in to vote
0

Help with Mouse and GUIs?

Asked by
MixCorp 70
7 years ago

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

Log in to vote
0
Answered by
BlueTaslem 18044 Moderation Voter Administrator Community Moderator Super Administrator
7 years ago

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);
0
Thanks man. MixCorp 70 — 7y
0
I have to ask. Why do scriptwriters put ";" in the code? It does no effect, and you don't need it. Nickoakz 231 — 7y
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 BlueTaslem 18044 — 7y
Ad

Answer this question