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

How to put delay after pressing a key?

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

✓ Accepted answer

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

1 comment

0

Does not work at all

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