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

Help with CFrame?

I was playing around with CFrames , and I tried calling this method called "CFrame:inverse()" on line 30 but the output says:

Players.Player1.PlayerGui.Script:30: attempt to call method 'inverse' (a nil value)

How would I call this method correctly?

Updated script

Player = game.Players.LocalPlayer
Character = Player.Character
Torso = Character.Torso
Mouse = Player:GetMouse()
----------------------------------------
function CharacterCheck()
    if not Character or Character.Parent == nil then
    Character = Player.CharacterAdded:wait()
    end
end
CharacterCheck()
----------------------------------------
function MakeWelds()
    local Arms = {Character["Left Arm"],
                  Character["Right Arm"]
    }
    local ArmWelds = {}
    for i,v in pairs (Arms) do
        local Weld = Instance.new("Weld",Torso)
        Weld.Name = v.Name.." Weld"
        Weld.Part0 = Torso
        Weld.Part1 = v
        ArmWelds[i] = Weld
    end
    return ArmWelds
end
Welds = MakeWelds()
Welds[1].C0 = CFrame.new(1.5,0,0)
Welds[2].C0 = CFrame.new(-1.5,0,0)
Welds[1].C0 = Welds[1].C0:inverse()
Welds[1].C0 = CFrame.Angles(Weld.C0.CFrame*CFrame.Angles(0,1,0))
----------------------------------------

1 answer

✓ Accepted answer

Inverse is a method. That means you call it on some particular CFrame value.

E.g., something like

Welds[1].C0 = Welds[1].C0:inverse()

Would change the C0 property to the inverse of the C0 property.

Inverses are defined such that A * A:inverse() is the default CFrame (this makes multiplying by it equivalent to using the more intuitive toObjectSpace method)

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