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

How would I Reference Myself in this script?

Asked by 7 years ago

I'm trying to make it so a brick orbits around the players torso. How would I make it so I reference a players own player?

local player = game.Players.LocalPlayer
soulBody = game.Players.LocalPlayer.Torso

Mouse = player:GetMouse()

function Orbit(infinite)
    local soul = Instance.new("Part" , workspace)
    soul.Name = ("Soul")
    soul.Anchored = false
    soul.CanCollide = false
    soul.Position = game.Players.LocalPlayer.Character.Torso.Position + Vector3.new(0,0,-8)
    soul.Size = Vector3.new(1,1,1)
    local soulObject = Soul
    local radius = 5
    repeat
        wait()
        for i=1,306 do
            soulObject.CFrame = CFrame.Angles(
                0,
                math.rad(i),
                0
                ) * CFrame.new(
                soulBody.CFrame.p + Vector3.new(
                    0,
                    0,
                    radius
                )
            )
        end
        until (
            infinite == false
            )
end

Mouse.KeyDown:connect(function(key)
    if key == "f" then
        Orbit()
    if key == "e" then
        print("You did not press the letter f, you pressed the letter e")
        end
    end
end)


Sorry if anything looks unorthodox or sloppy, I'm fairly new to scripting

0
What are you even asking? Yumeragon 45 — 7y

Answer this question