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!
A building system that works 100% - What is the issue? Include screenshots / videos if possible!
The further away that the block placement is from (0,0,0) the more offset the block placement is - What solutions have you tried so far? Did you look for solutions on the Creator Hub?
I tried changing a few parameters in the building system but I don’t know what to do anymore
heres code:
game:GetService("RunService").Stepped:Connect(function()
if buildType == "Build" then
local GridSize = 3
X = math.floor((Mouse.Hit.X + GridSize / GridSize) / GridSize) * GridSize
Y = math.ceil((Mouse.Hit.Y + GridSize / GridSize ) / GridSize) * GridSize - 1.5
Z = math.floor((Mouse.Hit.Z + GridSize / GridSize) / GridSize) * GridSize
Position = CFrame.new(X, Y, Z)
local target = Mouse.Target
if target ~= nil then
if game.Workspace.levelArea:FindFirstChild("BlockEffect") then
game.Workspace.levelArea:FindFirstChild("BlockEffect"):Destroy()
end
local Normal = Mouse.TargetSurface
if Normal == Enum.NormalId.Bottom then
Position += Vector3.new(0,-3,0)
end
if Normal == Enum.NormalId.Right then
Position += Vector3.new(3,0,0)
end
if Normal == Enum.NormalId.Back then
Position += Vector3.new(0,0,3)
end
local distance = (Mouse.Hit.p - game.Workspace:FindFirstChild(game.Players.LocalPlayer.Name).HumanoidRootPart.Position).Magnitude
if distance < Limit then
local shape = game.ReplicatedStorage.CurrentBlocks:FindFirstChildOfClass("Model"):Clone()
shape.PrimaryPart = shape:WaitForChild("Center")
shape:SetPrimaryPartCFrame(Position)
shape:SetPrimaryPartCFrame(shape.Center.CFrame * CFrame.Angles(RotationX, RotationY, RotationZ))
shape.Name = "BlockEffect"
for i, v in pairs(shape:GetChildren()) do
--if v:GetAttribute("hideInPrev") == false then
if v.Name ~= "Center" then
if v:IsA("MeshPart") or v:IsA("Part") then
if v.Name ~= "blockBehaviour" then
if v.Name ~= "Center" then
v.CanQuery = false
if v.Transparency ~= 1 then
v.Transparency = 0.5
end
v.CanCollide = false
end
end
end
end
end
shape.Parent = game.Workspace.levelArea
end
end
elseif buildType == "Delete" then
local Target = Mouse.Target
if Target ~= nil then
local distance = (Mouse.Hit.p - game.Workspace:FindFirstChild(game.Players.LocalPlayer.Name).HumanoidRootPart.Position).Magnitude
if distance < Limit then
if Target.Parent:FindFirstChild("BlockOwner") then
BlockHiglight.Parent = Target.Parent
else
BlockHiglight.Parent = nil
end
end
end
end
for i, c in uiBtns:GetChildren() do
if c:FindFirstChild("Checkmark") then
if c:IsA("ImageButton") then
c:FindFirstChild("Checkmark").Visible = false
end
end
end
if uiBtns:FindFirstChild(buildType) then
if uiBtns:FindFirstChild(buildType):FindFirstChild("Checkmark") then
uiBtns:FindFirstChild(buildType):FindFirstChild("Checkmark").Visible = true
end
end
if workspace.levelArea:FindFirstChild("BlockEffect") then
if buildType ~= "Build" then
workspace.levelArea:FindFirstChild("BlockEffect"):Destroy()
end
end
wait(0.01)
end)
I just want to fix this so I can have a good building system, and how do you detect finger tapping inputs for mobile support??