I had to get to my rig to test to be sure I’ll re-wright it.
Bro I’m sorry but what is this bru. Also, by my knowledge, how would this fix the holding issue? Since I wanted separate jump inputs for the double input detection.
I’ve tried using Enum.PlayerActions.CharacterJump
for ContextActionService
and it does technically work, but it does not work for mobile or console.
Are you trying to create a double jump script ??
I created a wall climbing/mantling system, but I would like to activate that functionality by a multi pressed input button (double tap the jump button)
I feel like the only way through this is either a script that’s long an unnecessary or through UIS.InputBegan. For Mobile you can opt for registering the button itself like so:
local UIS = game:GetService("UserInputService")
local PlayerGui = game:GetService("Players").LocalPlayer.PlayerGui
function CheckDoubleJump()
--Code Blah blah blah
end
if UIS.TouchEnabled then -- if a player is on mobile
PlayerGui:WaitForChild("TouchGui").TouchControlFrame:WaitForChild("JumpButton").TouchTap:Connect(CheckDoubleJump)
elseif UIS.KeyboardEnabled then -- if the player is on a desktop
UIS.InputBegan:Connect(function(Input, Processed)
if Processed then return end
if Input.KeyCode == Enum.KeyCode.Space then
CheckDoubleJump()
end
end)
end
for consoles you can just use the same method
Just for clarity, you would want the first time one presses the jump button nothing happens(not even a character jumping) but when the second press is made some few milliseconds after the game to activate the climbing feature ?
I went over my script more than a few versions… The post now seems pretty tight and is working as you wanted. However, going deeper to combat hackers is proving to be difficult, as so much relies on being in a client script for the calls to be usable… It would be nice to see a better version of that.
No. The character should jump, then while falling they should be able to climb up the wall.
I’ve been kinda avoiding this but I can try doing this.
“as so much relies on being in a client script for the calls to be usable”, can you elaborate?
Many of those commands can only be used in a LocalScript.
My guess would be to use a Vector3 push on a timer with a Remote, checking the sender.
… sounds messy.
Hello, read this over again and I’m not worried about exploiters at all. Roblox has a good anti-cheat at the moment and this system I made is purely client side (besides sending over custom states). If a player cheats then so be it.
make a timer that ticks when humanoid’s ground material is air
reset that timer when it is not air
make a timer threshold that you want the double jump to be inputted by
override the jump so it doesnt do anything
catch when the player requests a jump using the humanoid and check if they are grounded or the timer is within the timer threshold
if these checks pass then you just applyimpulse to the characters rootpart
(this is all client btw)
EDIT:
reading the post again to prevent the holding issue add a variable to switch off the jump request temporarily and enable it somewhere else
I decided to completely disregard JumpRequest due to it’s holding nature and I am going to instead just use UserInputService
or ContextActionService
, I will provide an update once I finish with it.
Ok then the script I’ve re-posted should be fine… Have you tested the newest re-post?
The code is fine for double-jumping, but not the type of “detection” I needed. I’m finishing up my iteration soon so I’ll lyk how that will go.
Hello everybody, thanks for all the help! I created a rough draft of the functionality I wanted. While this works, the code is currently not optimized the best and is not the cleanest. If you ever need this type of functionality, please clean up the code.
Thanks to @GuinPeng for giving me the bad news that I had to use UserInputService
local lastJumpTime = os.clock()
Humanoid.StateChanged:Connect(function(oldState, newState)
if newState == Enum.HumanoidStateType.Jumping then
hasJumped = true
lastJumpTime = os.clock() --Record the last jump time for climb window
elseif newState == Enum.HumanoidStateType.Landed then
hasJumped = false
end
end)
local IsTouchEnabled = UserInputService.TouchEnabled
local TestConn = nil
UserInputService.LastInputTypeChanged:Connect(function()
IsTouchEnabled = UserInputService.TouchEnabled
if not IsTouchEnabled then
if TestConn then
TestConn:Disconnect()
TestConn = nil
end
return
end
if TestConn then
return
end
local JumpButton: ImageButton = PlayerGui.TouchGui.TouchControlFrame.JumpButton
TestConn = JumpButton.InputBegan:Connect(function()
if not hasJumped then return end
if os.clock() - lastJumpTime < ALLOWED_MANTLE_THRESHOLD_TIME then return end
...
end)
end)
UserInputService.InputBegan:Connect(function(Input, GPE)
if GPE and not UserInputService.GamepadEnabled then return end --For some reason, console cannot detect the A button press when checking GPE
if not hasJumped then return end
if Input.KeyCode ~= TestInputs[Input.KeyCode] then return end
if os.clock() - lastJumpTime < ALLOWED_MANTLE_THRESHOLD_TIME then return end
...
end)
I hope it worked for you as intended.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.