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

how to let the game know that the player has tapped a button instead of holding it?

Asked by 3 years ago
Edited 3 years ago
--[[Leap]]--i dont understand tick that well and idk what the ticks are doing but all i know is they work
local C_ActService = game:GetService("ContextActionService")
local IsSprinting_Question = script.Parent.Speeding:WaitForChild("IsSprinting?")
local Tick = tick()

C_ActService:BindActionAtPriority("Leap", function(SprintPlusSpace, InputState, InputObject)
    if InputState == Enum.UserInputState.Begin and IsSprinting_Question.Value == true then
        local tIck = tick()
        local Difference = (tIck - Tick)

        if Difference <= 0.1 then --i wanted to make it so if you hold on to space for only 0.1 second or less you leap instead of doing a jump
            print("Leap") --i dont know how this should work yet but im trying to make it some what simlar to phantom force's leap
            --also you do leap in phantom forces by pressing w + leftshift + z
        end
        Tick = tick()
    end
end, false, 2, Enum.KeyCode.Space)

Answer this question