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

How do I check to see how many times the mouse was clicked?

Asked by 10 years ago

I want to check to see how many times it was clicked, in 10 seconds for now(for testing purposes) and then after 10 seconds are up, it will run certain animations based on how many clicks it had, the animations work fine, but the animations run as soon as I click, not waiting the 10 seconds to see how many times it was actually clicked.

m.Button1Down:connect(function()
if down == false and kdown1 == false then
kdown = true
RAW.Part1 = ra
local t2 = tick()
cliks = cliks + 1
if tick() - t2 < 10 then
if cliks == 1 then
coroutine.resume(coroutine.create(function()
for i=0,1,0.22 do
wait()
RAW.C0 = CFrame.Angles(0,0,math.rad(90*i))
end
end))
bg = Instance.new("BodyGyro", torso)
bg.maxTorque = Vector3.new(math.huge, math.huge, math.huge)
    bg.cframe = CFrame.new(torso.Position,Vector3.new(torso.Position.X,torso.Position.y,m.hit.p.z)) * CFrame.Angles(0, math.pi/2, 0)
down = false
elseif cliks == 2 then
coroutine.resume(coroutine.create(function()
for i=0,1,0.22 do
wait()
RAW.C0 = CFrame.Angles(0,0,math.rad(90*i))
end
end))
bg = Instance.new("BodyGyro", torso)
bg.maxTorque = Vector3.new(math.huge, math.huge, math.huge)
    bg.cframe = CFrame.new(torso.Position,Vector3.new(torso.Position.X,torso.Position.y,m.hit.p.z)) * CFrame.Angles(0, math.pi/2, 0)
down = false
bg.cframe = CFrame.new(torso.Position,Vector3.new(torso.Position.X,torso.Position.y,m.hit.p.z)) * CFrame.Angles(0, -math.pi/2, 0)
else
end
end
end
end)

Answer this question