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

How do you make a part circle a person when they enter a game?

Asked by 9 years ago

I want to make parts circle everyone that enters the game but when I try to do it all it does is make the part follow them.

game.Players.PlayerAdded:connect(function(Player)
    local pTorso = game.Workspace:WaitForChild(Player.Name).Torso
    local prt = Instance.new("Part", game.Workspace)
    prt.Anchored = true
    prt.Size = Vector3.new(1,1,1)
    while wait() do
        for angle = 1, 360 do
            prt.CFrame = CFrame.new(pTorso.Position) 
                       * CFrame.Angles(math.rad(angle), 0, 0) 
                       * CFrame.new(0, 0, 5)
        end
    end
end)

Thanks in Advance

Edit: I got it to work. I dont know what was wrong with it but when i change while wait() do to while true do and moved the wait below the last CFrame.new it worked

game.Players.PlayerAdded:connect(function(Player)
    local center = game.Workspace:WaitForChild(Player.Name).Torso
    local prt = Instance.new("Part", game.Workspace)
    prt.Anchored = true
    prt.Size = Vector3.new(1,1,1)
    while true do
        for angle = 1, 360 do
            prt.CFrame = CFrame.new(center.Position) 
                       * CFrame.Angles(0, math.rad(angle), 0) 
                       * CFrame.new(0,0,5)
            wait()
        end
    end
end)

0
You could use a CylinderMesh in the part, if I understand what your trying to do properly. ISellCows 2 — 9y
0
No that is not what I am trying to do. I am trying to get a part created when a person joins them game that just goes around them over and over again. Unvocalized 35 — 9y

Answer this question