-
What do you want to achieve? Keep it simple and clear!
I want to make a simple 2-script tool that allows you to place blocks in a grid. -
What is the issue? Include screenshots / videos if possible!
If you click on the side of a block with my tool, it usually goes inside of the block
-
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I’ve tried copying the last block placed position and raising the block up if it’s in the last position
**LocalScript**
local Mouse = game.Players.LocalPlayer:GetMouse()
local Positiona
local Limit = 25
script.Parent.Activated:Connect(function()
local distance = (Mouse.Hit.p - script.Parent.Parent.HumanoidRootPart.Position).Magnitude
if distance < Limit then
script.Parent.place:FireServer(Positiona)
end
end)
Mouse.Move:Connect(function()
local GridSize = 3
local X = math.floor((Mouse.Hit.X + GridSize / 2) / GridSize) * GridSize
local Y = math.ceil((Mouse.Hit.Y + GridSize / 4 ) / GridSize) * GridSize - 1.5
local Z = math.floor((Mouse.Hit.Z + GridSize / 2) / GridSize) * GridSize
Positiona = CFrame.new(X, Y, Z)
end)
**Normal Script**
script.Parent.place.OnServerEvent:Connect(function(player, Positiona)
local pitches = {
.99,
.995,
1,
1.05,
1.055
}
local finalpitch = pitches[math.random(1, #pitches)]
script.Parent.Handle.place.PlaybackSpeed = finalpitch
script.Parent.Handle.place:Play()
local shape = Instance.new("Part", workspace)
local tag = Instance.new("StringValue")
tag.Name = "blockowner"
tag.Value = player.Name
tag.Parent = shape
shape.Size = Vector3.new(3,3,3)
shape.Material = script.Parent.Handle.Material
shape.Anchored = true
shape.Color = script.Parent.Handle.Color
local soundforbreak = script.Parent.Handle.broken:Clone()
soundforbreak.Parent = shape
shape.CFrame = Positiona
end)