|
| 16 Aug 2014 10:55 AM |
I tried to re-script a crouch script that allows you to crouch by pressing a letter on the keyboard and I was trying to see if I could re-do the script to make you do a guarding stance like in basketball instead of crouch because both scripts had similarities.
Link to Guard Tool: Link to Crouch Hotkey Script:
Here's the script that I tried to re-do. _________________________________________________ on = 0 Tool = script.Parent welds = {} sh = {} arms = nil torso = nil function Guard(ison) if arms == nil and torso == nil then arms = {Tool.Parent:FindFirstChild("Left Arm"), Tool.Parent:FindFirstChild("Right Arm")} torso = Tool.Parent:FindFirstChild("Torso") if arms ~= nil and torso ~= nil then sh = {torso:FindFirstChild("Left Shoulder"), torso:FindFirstChild("Right Shoulder")} if sh ~= nil then local yes = true if yes then yes = false if ison == 1 then sh[1].Part1 = nil sh[2].Part1 = nil local weld1 = Instance.new("Weld") weld1.Part0 = torso weld1.Parent = torso weld1.Part1 = arms[1] weld1.C1 = CFrame.new(1, 1.3, 0) * CFrame.fromEulerAnglesXYZ(math.rad(0), 0, math.rad(75)) welds[1] = weld1 ------------------------------------------- local weld2 = Instance.new("Weld") weld2.Part0 = torso weld2.Parent = torso weld2.Part1 = arms[2] weld2.C1 = CFrame.new(-1.2, 1.3, -0.2) * CFrame.fromEulerAnglesXYZ(math.rad(0), math.rad(-15), -20) welds[2] = weld2 -- if arms ~= nil and torso ~= nil then local sh = {torso:FindFirstChild("Left Shoulder"), torso:FindFirstChild("Right Shoulder")} if sh ~= nil then local yes = true if yes then yes = false elseif ison == 0 then if arms then sh[1].Part1 = arms[1] sh[2].Part1 = arms[2] f.Parent = nil arms[2].Name = "Right Leg" arms[1].Name = "Left Leg" welds[1].Parent = nil welds[2].Parent = nil end else print("sh") end else print("arms") end end
end end
end else print("sh") end else print("arms") end end function Key(key) if key then key = string.lower(key) if (key=="c") then if on == 1 then on = 0 elseif on == 0 then on = 1 end Guard(on) end end end function Equip(mouse) mouse.KeyDown:connect(Key) end script.Parent.Equipped:connect(Equip) |
|
|
| Report Abuse |
|
|
| 16 Aug 2014 10:56 AM |
Woops forgot the links
:Guard tool: http://www.roblox.com/Guard-pick-and-dive-tool-item?id=163048603
:crouch hotkey: http://www.roblox.com/Crouch-Script-Put-IN-your-weapon-item?id=83920180 |
|
|
| Report Abuse |
|
| |