Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Can you help me on my Build script? [Solved]

Here is my code so far

MousePos=Mouse:CurrentPosition()
function Build()
	newBlock = game.Lighting.Block:clone()
	newBlock.Position.Vector3.new(MousePos)
	
end

while true do
	Mouse1.down:connect(Build)
end

What my code is trying to do is once you click, It clones my block in lighting, And makes it to the current mouse position Note: Im a rookie.

1 answer

✓ Accepted answer
part = game:GetService("Lighting"):FindFirstChild("Your Part Here")

game:GetService("Players").PlayerAdded:connect(function (player)
	playersParts = Instance.new("Model", workspace)
	playersParts.Name = player.Name.."'s Parts"
	mouse = player:GetMouse()
	mouse.Button1Down:connect(function ()
		clone = part:clone()
		clone.Parent = playersParts
		clone.CFrame = CFrame.new(mouse.Hit.p)
	end)
end)

20 comments

0

Thank you

0

It's not working! D:

0

Answer is edited

0

Still dosent work

0

Hmm, Wierd, It is'nt working

0

There, this should work. Sorry, a bit rusty.

0

It's ok, I understand about your problems

0

Found your problem: Mouse for some strange reason is a nil value.

0

It works for me. The mouse tag is lowercase, by the way.

0

i know, mouse is a nil value, Let me actully add a baseplate, Its probbaly because there are Terrain blocks only

0

Okay, let me know how that works.

0

Alright, It fixed mouse being a nil value, But, Now its having Line 8's problem, clone = part:clone()

0

Make sure you have a part in Lighting, and change the first line accordingly. :FindFIrstChild("Your Part Here")

0

Nevermind, The part was not named Your part here, It was named block and FindFirstChild Was Your part here

0

I thought so :-P

0

Well it works now, Thanks for the help

0

My pleasure, sir.

0

Works in studio debug game mode, But not pressing the play button

0

Very odd indeed.

0

Can you fix it drak?

This discussion is preserved as it was. New answers, comments, and votes are closed.