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

How would I make a debounce for this script?

Asked by 9 years ago
pname = script.Parent.Name
player = game.Players:FindFirstChild(pname)
p = script.Parent
Mouse = player:GetMouse()
ls = p.Torso['Left Shoulder']
rs = p.Torso['Right Shoulder']
lh = p.Torso['Left Hip']
rh = p.Torso['Right Hip']
n = p.Torso['Neck']
la = p['Left Arm']
ra = p['Right Arm']
Mouse.KeyDown:connect(function(Key)
    if Key == 'f' then
        p.Torso.Anchored = true
        ls.C0 = ls.C0 *CFrame.Angles(0,-.4,-1.5)
        rs.C0 = rs.C0 *CFrame.Angles(0,.4,1.5)
        sphere = Instance.new('Part', p)
        sphere.CanCollide = false
        sphere.Transparency = .5
        sphere.Shape = 'Ball'
        sphere.Anchored = true
        sphere.BrickColor = BrickColor.new('Really red')
        sphere.Size = Vector3.new(2,2,2)
        sphere.CFrame = p.Torso.CFrame *CFrame.new(0,0,-2)
        wait(5)
        ls.C0 = ls.C0 *CFrame.Angles(-.42,.04,1.5)
        rs.C0 = rs.C0 *CFrame.Angles(-.42,-.04,-1.5)
        p.Torso.Anchored = false
        sphere:remove()
    end
end)

I have tried a few diff times and yet all it would do at that point is it would spam it...

1 answer

Log in to vote
0
Answered by
Lacryma 548 Moderation Voter
9 years ago

--This is much easier than what you were doing local player = game.Players.LocalPlayer local p = player.Character or player.CharacterAdded:wait() -- Mouse = player:GetMouse() ls = p.Torso['Left Shoulder'] rs = p.Torso['Right Shoulder'] lh = p.Torso['Left Hip'] rh = p.Torso['Right Hip'] n = p.Torso['Neck'] la = p['Left Arm'] ra = p['Right Arm'] --IMPLEMENTED HERE deb = false -- Mouse.KeyDown:connect(function(Key) if Key == 'f' and not deb then deb = true p.Torso.Anchored = true ls.C0 = ls.C0 *CFrame.Angles(0,-.4,-1.5) rs.C0 = rs.C0 *CFrame.Angles(0,.4,1.5) sphere = Instance.new('Part', p) sphere.CanCollide = false sphere.Transparency = .5 sphere.Shape = 'Ball' sphere.Anchored = true sphere.BrickColor = BrickColor.new('Really red') sphere.Size = Vector3.new(2,2,2) sphere.CFrame = p.Torso.CFrame *CFrame.new(0,0,-2) wait(5) ls.C0 = ls.C0 *CFrame.Angles(-.42,.04,1.5) rs.C0 = rs.C0 *CFrame.Angles(-.42,-.04,-1.5) p.Torso.Anchored = false sphere:remove() deb = false end end)

Learn more here

Ad

Answer this question