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

I'm confused on whether my door script needs a GUI or Ray?

Asked by 4 years ago

Basically i'm trying to script a door that opens and closes based on the player's mouse movement. If the mouse's Y position goes up, then the door opens a little... etc...

The problem is I don't know if I should be using a GUI to detect the Mouse's Y position, or if I should be using Rays. If it's rays then imma need some help. I've never used rays before, and they seem.... intimidating....

I don't have any example script to show since i'm still stuck on this situation.

1 answer

Log in to vote
0
Answered by
Xapelize 2658 Moderation Voter Community Moderator
4 years ago

You can local the mouse with using :GetMouse. Also, you can just get the Mouse X axis and Y axis by simply do :GetMouse.X or :GetMouse.Y. Besides, we don't need to use GUI or rays. Because they're not suited to this situation anyways, let get right into the script.

Let use Mouse's X-axis to do an example...

local screengui = Instance.new("ScreenGui", StarterGui)
local textlabel = Instance.new("TextLabel", screengui)


while wait() do
textlabel.Text = "Current Mouse X-axis: ".. game:GetMouse().X
end

Ok, I think you can figure out how this script works, scripting helpers isn't giving the answer, you need to think about it.

If you have more questions, comment below, or PM me in my ROBLOX profile! I'll be glad to help you in anytime. Bye bye~

0
If the scrpit not working though, comment below :D Xapelize 2658 — 4y
Ad

Answer this question