Hello devs! So, I’m trying to make a placement system I can do the placing stuff but I’m really confused at the object movement part. I want to make it in grid. I’ve tried a lot of stuff, went through a lot of posts, youtube videos but really found nothing useful.
It will be really appreciated if anybody can help me (Again I’m not asking for scripts but I’ve no idea of how to do it). Thanks for any help!
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
local Grid = 4
Mouse.Move:Connect(function()
local X = math.floor((Mouse.Hit.X + Grid / 2) / Grid) * Grid
local Y = Mouse.Hit.Y + Grid / 2
local Z = math.floor((Mouse.Hit.Z + Grid / 2) / Grid) * Grid
game.Workspace.Block:SetPrimaryPartCFrame(CFrame.new(X, Y, Z))
Mouse.TargetFilter = game.Workspace.Block
end)
NOTE:I haven’t made the script by myself but yes, I have changed a few stuff.
on each math.floor and tell me if it works smooth if is; then it has to do with your Grid variable, i honestly try setting the Grid to lowest possible like 1.