Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How do you make bricks appear around your player?

Asked by 10 years ago

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

Log in to vote
1
Answered by
MrNicNac 855 Moderation Voter
10 years ago

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)
Ad
Log in to vote
0
Answered by
User#2 0
10 years ago

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

Answer this question