You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Keep it simple and clear!
I want to create a simple grid building system that costs money to build stuff, like it costs $50 to build table, $300 to build house, etc. I am aiming to create similar building system like one in ‘Eclipsis’, that also allows u to build on any Y level which is what I am trying to do for my game.
What is the issue? Include screenshots / videos if possible!
I don’t know how to make one, I looked everywhere for any useful resources or information but I didn’t find anything that really helps my goal.
You can use the math.floor() function to create a grid snapping effect if you pair it with mouse.Hit.Position.
Here’s a code snippet that could help you get started:
--[[ Local Script ]]--
local Players = game:GetService("Players")
local RunService = game:GetService("RunSerivce")
local localPlayer = Players.LocalPlayer
local Mouse = localPlayer:GetMouse()
local partToPlace = Instance.new("Part")
partToPlace.Parent = game.Workspace
local gridSize = 3
local function snapToGrid(position: Vector3)
local function round(num)
return math.floor(num/gridSize) * gridSize
end
return Vector3.new(round(position.X), round(position.Y), round(position.Z))
end
RunderService.RenderStepped:Connect(function()
local gridLocation = snapToGrid(mouse.Hit.Position)
part.Position = gridLocation
end)
-- Untested btw