Hi, I’ll just get right into it.
I have a placement system that uses the Tunicus Placement Module, which allows me to place items down on my base in a grid of 3 studs. The system works, except the fact that exploiters are able to re-size their baseplate to place items in the air, or where not intended. Here is an example gif: https://gyazo.com/d050f02921901f0756c99013777bdfbc
I have already tried using math.clamp in order to limit the CFrame so that they can’t do it, but it didnt fully work.
Here is the math calculating that, let me know if I some how did the math wrong.
(location is just the CFrame given by the client, truebase is the baseplate)
local x,y,z,r00,r01,r02,r10,r11,r12,r20,r21,r22 = location:components()
local lowerX = truebase.Position.X - (truebase.Size.X / 2)
local upperX = truebase.Position.X + (truebase.Size.X / 2)
local lowerZ = truebase.Position.Z - (truebase.Size.Z / 2)
local upperZ = truebase.Position.Z + (truebase.Size.Z / 2)
local newlocation = CFrame.new(math.clamp(x, lowerX, upperX), y, math.clamp(z, lowerZ, upperZ),r00,r01,r02,r10,r11,r12,r20,r21,r22)
I have also tried using the Tunicus Placing Module on the server, but since its mostly client side stuff, it errors.
What other ways are there to either limit the CFrame onto the base, or somehow get the grid from the Module onto the server?
Here is the full server side script if you want to take a look at it
rs.Functions.Placement.OnServerInvoke = function(player, art, item, location)
if placedeb == 1 and item then
placedeb = 2
local realitem = rs.Items:FindFirstChild(item.Name)
if art == "Place" then
if realitem then
if player.Inventory:FindFirstChild(item.Name) then
if player.Inventory[item.Name].Value > 0 then
local base = getBase(player)
local truebase = base.Base
local tempitem = realitem:Clone()
tempitem.Parent = base.Items
tempitem:SetPrimaryPartCFrame(location)
undothing = tempitem
local box = Instance.new("SelectionBox")
box.LineThickness = 0.05
box.Adornee = tempitem.Hitbox
box.Parent = player.PlayerGui
if player.Inventory[item.Name].Value > 1 then
player.Inventory[item.Name].Value = player.Inventory[item.Name].Value - 1
else
player.Inventory[item.Name]:Destroy()
end
end
end
end