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

Gridded movement in MH2?

How would I make gridded movement like in Miner's Haven? In the game, I can select an item from my inventory and the item will snap to the grid when I move the mouse over it but will not move outside of the grid.

What systems will I need to make and how will I go about using them

1 comment

0

You would need to use player:GetMouse(), then round it to the grid stud, and figure out were that is on the board.

1 answer

This can be achieved using the Hit property of the PlayerMouse instance which can be retrieved using the :GetMouse() method of the LocalPlayer. To grid the position, you will need to math.floor() the x, y and z of the Hit. Then just repeatedly CFrame a part to the floored hit. The below code will create a grid on the CFrame.

local m = game:GetService("Players").LocalPlayer:GetMouse()
local h = m.Hit
local gridCFrame = CFrame.new(h.x, h.y, h.z)

I hope my answer solved your problem! If it did please remember to mark it as correct! :)

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