#Does anyone know how i could line up my placement items with the texture that is on the floor?

1 messages · Page 1 of 1 (latest)

fleet talon
#

And this is my local script

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ContextActionService = game:GetService("ContextActionService")
local GetPlot = ReplicatedStorage:WaitForChild("PlotSystem"):WaitForChild("GetPlot")
local ClientPlacer = require(script.Parent:WaitForChild("ClientPlacer"))

local placer = nil

local function setPlacementActive(_, state, _)
    if state ~= Enum.UserInputState.Begin then 
        return
    end
    
    if not placer then 
        local plot = GetPlot:InvokeServer()
        plot.Base.Grid.Transparency = 0
        placer = ClientPlacer.new(plot)
    else 
        local plot = GetPlot:InvokeServer()
        plot.Base.Grid.Transparency = 1
        placer:Destroy()
        placer = nil
    end
end

ContextActionService:BindAction("ActivatePlacement", setPlacementActive, false, Enum.KeyCode.B)```
steel mirage
fleet talon
# steel mirage maybe round the plot's position?

i tried to do this

local function snapToGrid(pos: Vector3, gridX: number, gridZ: number, origin: Vector3?)
    local base = origin or Vector3.zero
    local x = math.round((pos.X - base.X) / gridX) * gridX + base.X
    local z = math.round((pos.Z - base.Z) / gridZ) * gridZ + base.Z
    return Vector3.new(x, pos.Y, z)
end```
#

but it doesnt work as well becausew it doesnt snap to the edge

steel mirage
#

no like round the position of the plot part

fleet talon
steel mirage
#

no in the editor

fleet talon
steel mirage
#

yeah

fleet talon
steel mirage
#

and the size is round too?