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

How to put delay after pressing a key?

Asked by 10 years ago

Script \/

if key == "f" then
        Barrel = script.Parent.Parent.Parent.Character.Experimentalheli.Controls.Barrel
        Killscript = script.Killer
        m = Instance.new("Model")
        m.Parent = game.Workspace
        c = Instance.new("Part")
        c.Parent = m
        c.Name = "Paintball"
        c.BrickColor = BrickColor.new("Bright yellow")
        c.Size = Vector3.new(1, 1, 1)
        c.BottomSurface = "Smooth"
        c.TopSurface = "Smooth"
        c.Position = Barrel.Position
        c.CanCollide = false
        b = Instance.new("BlockMesh")
        b.Scale = Vector3.new(0.5, 0.5, 0.5)
        b.Parent = c
        t = Instance.new("BodyVelocity")
        t.maxForce = Vector3.new(math.huge, math.huge, math.huge)
        t.velocity = Barrel.CFrame.lookVector * 8000
        t.Parent = c
        a = Killscript:clone()
        a.Parent = c
        tr = script.Trail:Clone()
        tr.Parent = c
        Barrel.Firesound:Play()
        wait()
        t:Destroy()
    end

What I mean is after you press "F", it takes like 1 sec for it to allow you to press "F" again. I tried wait() at the end of the if statement.

1 answer

Log in to vote
0
Answered by 10 years ago

Simply change wait() at the bottom of the script to wait(1) .

0
Does not work at all supermarioworld323 45 — 10y
Ad

Answer this question