Still have questions? Join our Discord server and get real time help.
Log in to vote

How would I recreate a building tool that can place blocks?

Asked by 1 year ago

Greetings fellow scripters, I'm here today wondering how I can make a building tool like stamper build, but to place blocks in FE. My goal is to recreate build to survive zombies, with old roblox materials as textures. Why I want to make this game is because it was a really good game back in the time. Anyways, here is my script. It can't use the Z; most likely because I haven't explored a certain thing required for me for this script.



local mouse = game.Players.LocalPlayer:GetMouse()

local X = mouse.X

local Y = mouse.Y

local Z = mouse.Z





game.ReplicatedStorage.BuildObject.OnServerInvoke = function(X,Y)

local block ="Part",workspace)

block.Size =,4,4)

block.BrickColor ="Brown")

local t1 ="Texture",block)

local t2 ="Texture",block)

local t3 ="Texture",block)

local t4 ="Texture",block)

local t5 ="Texture",block)

local t6 ="Texture",block)

t1.Texture = "rbxassetid://155806200"

t2.Texture = "rbxassetid://155806200"

t3.Texture = "rbxassetid://155806200"

t4.Texture = "rbxassetid://155806200"

t5.Texture = "rbxassetid://155806200"

t6.Texture = "rbxassetid://155806200"

t1.Face = "Front"

t2.Face = "Back"

t3.Face = "Bottom"

t4.Face = "Top"

t5.Face = "Left"

t6.Face = "Right"

block.Position =,Y,0)


I'm quite sorry for the messy code above.

1 answer

Log in to vote
Answered by
A_thruZ 29
1 year ago

One reason it might be is because you are using Mouse.X , Mouse.Y, and Mouse.Z. To fix the problem with the Z, is to change each of them to Mouse.Hit.p.X, Mouse.Hit.p.Y, and Mouse.Hit.p.Z. Or otherwise, you can just erase X, Y, and Z and use Mouse.Hit.p for the whole set of 3 arguments, since Mouse.Hit.p returns a Vector3 Value.

So now, for the whole Drag'n'Drop the pieces system, you can create a new variable, called Target. Then you can create code to set the Target to mouse.Target when the mouse presses down on an object, and then sets Target to nil when releasing. Simply using mouse.Target doesn't work, since eventually the player might move their mouse too fast, and end up dropping the piece. Using a variable, will make the piece the same one the player starts dragging, and Target will stay until the player lets go of their mouse, so from a LocalScript, you could try this: local player = game.Players.LocalPlayer local mouse = player:GetMouse() local target = nil mouse.Button1Down:Connect(function() if mouse.Target then if mouse.Target.Locked == false and mouse.Target.Anchored == false then target = Mouse.Target end end end) mouse.Button1Up:Connect(function() if target then target = nil end end) while true do target.Position = Mouse.Hit.p end

Ill be sure to try, thanks. :D User#22722 20 — 1y

Answer this question