#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)
This is my ClientPlacer Module Script
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)```
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
no like round the position of the plot part
in the snapToGrid function?
no in the editor
wait you mean like the actual part?
yeah
ohh right, well i tried that and still no work
and the size is round too?