Hey, I'm messing around with Studio and I'm trying to setup a grid system for my game. Basically - I have a 144 x 144 stud plate and various models, all of which have X and Y dimensions that are multiples of 3 and I want all of these objects to follow the mouse cursor following a 3 x 3 grid until the player clicks, then the object is placed in that location. Here is my current code (pretty much just placing on click, regardless of mouse location.).
local Mouse = Player:GetMouse()
Mouse.Button1Down:connect(function()
partToPlace = game.ReplicatedStorage.Counter_001:Clone();
partToPlace:MoveTo(Vector3.new(Mouse.X, Mouse.Y, 1));
partToPlace.Parent = workspace;
end)
A bit of background - I know C# and Java/script syntax very well and wanted to give LUA a shot. Thanks! |