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

How do you make a player un-duck w/o killing them?

Asked by 9 years ago

Here is the jist of what I have tried.

function duck()
    weld=Instance.new("Weld", player.Character.Torso)
    weld.Part0=player.Character.Torso
    weld.Part1=player.Character.Head
    weld.C0=CFrame.new(0,1,0)
    weld2=Instance.new("Weld", player.Character.Torso)
    weld2.Part0=player.Character.Torso
    weld2.Part1=player.Character["Left Leg"]
    weld2.C0=CFrame.new(-2,-1,-1)*CFrame.Angles(math.rad(-90),0,0)
    weld3=Instance.new("Weld", player.Character.Torso)
    weld3.Part0=player.Character.Torso
    weld3.Part1=player.Character["Right Leg"]
    weld3.C0=CFrame.new(2,-1,-1)*CFrame.Angles(math.rad(-90),0,0)
end
function unDuck()
    local intPlayerHealth=player.Character.Humanoid.Health
    weld.C0=CFrame.new(0,2,0)
    weld2.C0=CFrame.new(-2,-2,0)*CFrame.Angles(math.rad(-90),0,0)
    weld3.C0=CFrame.new(2,-2,0)*CFrame.Angles(math.rad(-90),0,0)
    for i,v in pairs (player.Character.Torso:GetChildren()) do
        if v:IsA("Weld") then v:Destroy() player.Character.Humanoid.Health=intPlayerHealth end
    end
    player.Character:MakeJoints()
    player.Character.Humanoid.Health=intPlayerHealth
end
1
Edit your post to use Lua code formatting (select the entire script and press the Lua button) BlueTaslem 18071 — 9y
0
Thanks. protectiveebob 221 — 9y

1 answer

Log in to vote
-1
Answered by 9 years ago

You put 'math.rad' it is math.random

1
math.rad() is in redians, so that I put the angle that I want in terms of degrees, and it translates it into EUlar Angles, as far as I understand. protectiveebob 221 — 9y
Ad

Answer this question