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

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

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

2 comments

1

Edit your post to use Lua code formatting (select the entire script and press the Lua button)

0

Thanks.

1 answer

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

1 comment

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.

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