#Check time between Input.Began and Input.Ended

3 messages · Page 1 of 1 (latest)

karmic reef
#

How do I check the time between Input.Began and Input.Ended?

frosty obsidian
#

You could make a varible outside of the functions, then in input began set it to tick(), then in input ended the time difference will be tick() - that varible

#
local lastTime = tick()

game:GetService("UserInputService").InputBegan:Connect(function(key)
    lastTime = tick()
end)

game:GetService("UserInputService").InputEnded:Connect(function(key)
    print(tick()-lastTime)
end)```