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

How do you make bricks appear around your player?

Say, if you had a tool, and if you clicked it, it would make a jail around (ex.) How would you do that?

I know you'd probably use Instance.new, but how would you make it appear a certain distance around the player?

2 answers

Here, this script should give you a good idea as to how to do it. It works as is, but you can make changes to it.

local bar = Instance.new("Part")
bar.BrickColor = BrickColor.Black();
bar.Size = Vector3.new(1,10,1);
bar.Anchored = true;

function Jail(part)
	local bars = 10
	for i = 1, bars do
		local a = bar:Clone()
		a.Parent = Workspace
		a.CFrame = part.CFrame * (CFrame.Angles(0,math.rad(360/bars) * i,0) * CFrame.new(0,5,5))
	end
end

script.Parent.Equipped:connect(function(mouse)
	mouse.Button1Down:connect(function()
		if mouse.Target then
			Jail(mouse.Target);
		end
	end)
end)

Use the CFrame property of your new parts and to find the origin of the player, grab the CFrame of the Player's torso.

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