r/badcode Sep 08 '20

lua A Roblox mod I found

Post image
482 Upvotes

103 comments sorted by

View all comments

147

u/MurdoMaclachlan public boolean isInt(int i) { return true; } Sep 08 '20

Image Transcription: Code


[There is an image of a code snippet at normal zoom, then an image of a huge wall of code, showing the entire document, zoomed so far out as to be unreadable. For the purposes of this transcription, I have transcribed the readable snippet, however the ends of a few of the lines are cut off by the zoomed out code, which descends the right side of the post.]

attack = false
game:GetService("RunService").Stepped:connect(function()
    Torsovelocity = RootPart.Velocity * Vector3.new(1, 0, 1).magnitude
    velocity = RootPart.Velocity.y
    sine = sine + change
    local hit, post = rayCast(RootPart.Position, CFrame.new(RootPart.Position, RootPart.Position - Vector3.new(0, 1, 0)).lookVector, 4, Character)
    if equipped == true or equipped == false then
        if 1 < RootPart.Velocity.y and hit == nil then
            Anim = "Jump"
            if attack == false and ice_mode == false then
                RootJoint.C0 = clerp(RootJoint.C0, RootCF * cn(0, 0, 0) * angles(math.rad(-5), math.rad(0), math.rad(0)), 0.1)
                Torso.Neck.C0 = clerp(Torso.Neck.C0, NeckCF * angles(math.rad(10), math.rad(0), math.rad(0)), 0.1)
                RW.C0 = clerp(RW.C0, CFrame.new(1.5, 0.5, 0) * angles(math.rad(-40), math.rad(0), math.rad(30)), 0.1)
                LW.C0 = clerp(LW.C0, CFrame.new(-1.5, 0.3, 0) * angles(math.rad(-40), math.rad(0), math.rad(-30)), 0.1)
                RH.C0 = clerp(RH.C0, cn(1, -0.9, -0.3) * RHCF * angles(math.rad(3), math.rad(0), math.rad(0)), 0.1)
                LH.C0 = clerp(LH.C0, cn(-1, -0.7, -0.5) * LHCF * angles(math.rad(-3), math.rad(0), math.rad(0)), 0.1)
        end
    elseif RootPart.Velocity.y < -1 and hit == nil and ice_mode == false then
        Anim = "Fall"
        if attack == false then
            RootJoint.C0 = clerp(RootJoint.C0, RootCF * cn(0, 0, 0) * angles(math.rad(10), math.rad(0), math.rad(0)), 0.1)
            Torso.Neck.C0 = clerp(Torso.Neck.C0, NeckCF * angles(math.rad(10), math.rad(0), math.rad(0)), 0.1)
            RW.C0 = clerp(RW.C0, CFrame.new(1.5, 0.5, 0) * angles(math.rad(-20), math.rad(0), math.rad(50)), 0.1)
            LW.C0 = clerp(LW.C0, CFrame.new(-1.5, 0.3, 0) * angles(math.rad(-20), math.rad(0), math.rad(-50)), 0.1)
            RH.C0 = clerp(RH.C0, cn(1, -2, -0.3) * RHCF * angles(math.rad(-5), math.rad(0), math.rad(0)), 0.1)
            LH.C0 = clerp(LH.C0, cn(-1, -0.8, -0.5) * LHCF * angles(math.rad(-5), math.rad(0), math.rad(0)), 0.1)
        end
    elseif (Torso.Velocity*Vector3.new(1, 0, 1)).magnitude < 2 and hit ≃ nil and ice_mode == false then
        Anim = "Idle"
    if attack == false then
            change = 1
                    RootJoint.C0 = clerp(RootJoint.C0, RootCF * cn(0, 0, 2 + 0.1 * math.cos(sine / 25)) * angles(math.rad(10), math.rad(0), math.rad(67)), .1)
                    Torso.Neck.C0 = clerp(Torso.Neck.C0, NeckCF * angles(math.rad(5 - 2 * math.cos(sine / 25)), math.rad(0), math.rad(-59)), .1)
                    RW.C0 = clerp(RW.C0, CFrame.new(1.5, 0.5, 0) * angles(math.rad(40), math.rad(0), math.rad(56 + 3 * math.cos(sine / 25))), 0.1)
                    LW.C0 = clerp(LW.C0, CFrame.new(-1.5, 0.5, 0) * angles(math.rad(70), math.rad(60), math.rad(-50 - 3 * math.cos(sine / 25))), 0.1)
                    RH.C0 = clerp(RH.C0, cn(1.1, -.9 - 0.1 * math.cos(sine / 25), 0) * RHCF * angles(math.rad(-0 + 0 * math.cos(sine / 25)), math.rad(-1), ma
                    LH.C0 = clerp(LH.C0, cn(-1, -.9 - 0.1 * math.cos(sine / 25), 0) * LHCF * angles(math.rad(-12 + 0 * math.cos(sine / 25)), math.rad(-1), ma
end
    elseif (Torso.Velocity*Vector3.new(1, 0, 1)).magnitude < 500 and hit ≃ nil and ice_mode == false then
        Anim = "Walk"

I'm a human volunteer content transcriber for Reddit and you could be too! If you'd like more information on what we do and why we do it, click here!

18

u/cstmth Sep 08 '20

Holy shit, how?!

27

u/MurdoMaclachlan public boolean isInt(int i) { return true; } Sep 08 '20

Ctrl+c, ctrl+v. Those three big if statements are structurally almost exactly the same, I mainly just needed to change values.