Hey devs!
I’ve been working on a game for a little while that is inspired from a a mobile game in which you connect different orbs to make different combos and such. The camera locks in to a specific spot in a given plot, (I’ll provide pictures), but I want the player to be able to move the mouse back and forth over a specific range to see a preview of where the orb will drop.
However, I really don’t know how I would go about doing this. I considered using GetMouse and then just seeing if the mouse is in a certain X range given what plot the player has chosen, but then I realized my plots are lined on the Z axes. Problem is, given a mouse’ 2-D nature, it doesn’t have that.
I don’t think if I changed them to line the X that it would fix the issue, but correct me if im wrong.
If I’m understanding you correctly, what you need is to check the target of the mouse.
This will be the object in 3D space the mouse is pointing to.
Here’s how you could implement it into your script:
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
--Reference both parts in the workspace
local plot
local orb
local function ShowOrbPath()
--Checking if mouse is over the plot
if mouse.Target == plot then
--Draw orb path
else
--Hide orb path
end
end
mouse.Move:Connect(ShowOrbPath)