Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How do i make blocks stack on each other?

Asked by 5 years ago

So my friend gave me this kit he made but he never told me how to make it not snap to grid So i can make a second floor it say's it has a snap to grid setting but it does not work Is there anyway to make it go on top of a placed item if it is hover'd over or if your mouse is in the air it goes off the ground instead of it staying on ground Here is the code LONG CODE


local function enablePlacement(plane, models, prealigned) if (plane == currentPlane) then return elseif (currentPlane) then currentPlane:disable() end if (type(models) ~= "table") then models = {models} end lastRenderCycle = tick() currentPlane = plane currentBase = plane.base local planePosition = currentBase.CFrame * Vector3.new(0, currentBase.Size.Y/2, 0) resting = false ox, oy, oz = planePosition.X, planePosition.Y, planePosition.Z currentXAxis = currentBase.CFrame.rightVector currentYAxis = currentBase.CFrame.upVector currentZAxis = currentBase.CFrame.lookVector currentAxis = CFrame.new(0, 0, 0, currentXAxis.X, currentYAxis.X, -currentZAxis.X, currentXAxis.Y, currentYAxis.Y, -currentZAxis.Y, currentXAxis.Z, currentYAxis.Z, -currentZAxis.Z) currentObjects = {} dxx, dxy, dxz = currentXAxis.X, currentXAxis.Y, currentXAxis.Z dzx, dzy, dzz = currentZAxis.X, currentZAxis.Y, currentZAxis.Z cx, cy, cz, cr = 0, 0, 0, 0 springVelocity = Vector3.new(0, 0, 0) springPosition = Vector3.new(0, 0, 0) tweenAlpha = 0 tweenCurrentRotation = 0 tweenGoalRotation = 0 tweenStartRotation = 0 local position, _ = inputCapture() if (not position) then position = planePosition end springPosition = position do local extentsXMin, extentsXMax = 10e10, -10e10 local extentsZMin, extentsZMax = 10e10, -10e10 for i = 1, #models do local model = models[i] local object = {} object.model = model local lookVector = object.model.PrimaryPart.CFrame.lookVector local theta local px, pz if (prealigned) then local position = object.model.PrimaryPart.CFrame * Vector3.new(0, -object.model.PrimaryPart.Size.Y/2 , 0) px, pz = project(position.X, position.Y, position.Z) theta = math.acos(math.clamp(lookVector:Dot(currentZAxis), -1, 1)) local cross = lookVector:Cross(currentZAxis) if (cross:Dot(currentYAxis) > 0) then theta = -theta end else px, pz = object.model.PrimaryPart.Position.X, object.model.PrimaryPart.Position.Z theta = math.atan2(lookVector.X, lookVector.Z) end local x, z = model.PrimaryPart.Size.X, model.PrimaryPart.Size.Z object.r = round((theta % (2 * math.pi))/(math.pi/2), 1) if (object.r == 1 or object.r == 3) then x, z = z, x end local x1, x2 = px + x/2, px - x/2 local z1, z2 = pz + z/2, pz - z/2 if (x2 < extentsXMin) then extentsXMin = x2 end if (x1 > extentsXMax) then extentsXMax = x1 end if (z2 < extentsZMin) then extentsZMin = z2 end if (z1 > extentsZMax) then extentsZMax = z1 end model.PrimaryPart.Transparency = .5 model.PrimaryPart.Anchored = true model.PrimaryPart.CanCollide = false setState(object, plane.loading and states.loading or states.neutral) currentObjects[i] = object end currentExtentsX, currentExtentsZ = round(extentsXMax - extentsXMin, currentPlane.grid), round(extentsZMax - extentsZMin, currentPlane.grid) for i = 1, #currentObjects do local object = currentObjects[i] local px, pz if (prealigned) then local position = object.model.PrimaryPart.CFrame * Vector3.new(0, -object.model.PrimaryPart.Size.Y/2, 0) px, pz = project(position.X, position.Y, position.Z) else px, pz = object.model.PrimaryPart.Position.X, object.model.PrimaryPart.Position.Z end object.px = px - (extentsXMin + extentsXMax)/2 object.pz = (pz - (extentsZMin + extentsZMax)/2) * (prealigned and -1 or 1) object.sx, object.sy, object.sz = object.model.PrimaryPart.Size.X, object.model.PrimaryPart.Size.Y, object.model.PrimaryPart.Size.Z end end renderConnection = runService.RenderStepped:connect(run) module.currentPlane = currentPlane currentEvent = Instance.new("BindableEvent") if (GRID_TEXTURE) then currentTexture = Instance.new("Texture", currentPlane.base) currentTexture.Texture = GRID_TEXTURE currentTexture.Face = Enum.NormalId.Top currentTexture.StudsPerTileU = currentPlane.grid currentTexture.StudsPerTileV = currentPlane.grid end bindInputs() run(true) return currentEvent.Event end
0
I dont get what game you're trying to make lol iuclds 720 — 5y
0
Ok so the placement is already there and places stuff but it only places on the ground i want it to go in the air kinda like bloxburg how you can make second floor. Corrupt_Wolfstrik3r 51 — 5y

1 answer

Log in to vote
1
Answered by 5 years ago

Lol just:

while true do
part = instance.new("Part")
part.parent = game.workspace
end
Ad

Answer this question