I am trying to make a script that has 2 keybinds. 1 starts a timer that in this time slot the other can be pressed. I have it in a local script.
local player = script.Parent.Parent.Parent
local char = player.Character
local torso = char.Torso
local going = false
local timer = 0
local deb = false
local mouse = player:GetMouse()
function normaltorotate()
torso.CFrame = torso.CFrame *CFrame.Angles(0,1,0)
going = true
print('rotated')
torso.Anchored = true
end
function pulsedet()
print('detonation')
torso.Anchored = false
end
mouse.KeyDown:connect(function(rotate, pulse)
if rotate == 'f' and not deb then
deb = true
normaltorotate()
while going do
if pulse == 'g' and going then
pulsedet()
end
timer = timer+1
if timer >= 5 then
timer = 0
beb = false
torso.Anchored = false
going = false
end
wait(.5)
end
end
end)

3 comments
so the keydown would have to be in the loop?
got it :D thx
What?