Help with JJ system

  1. What do you want to achieve? I’m attempting to create a JJ system, and for those of you unaware of what JJs is, it’s when a player jumps and then repeats numbers.

  2. What is the issue? I’m attempting to make a detection script when a player jumps and sends a message at the same time, but I’m having trouble figuring out how to do this…

  3. What solutions have you tried so far? Devhub, youtube

Script i have so far:
UIS.InputEnded:Connect(function(input, isType)
	if not isType then
		if inputNeeded == false then
			if input == Enum.KeyCode.Space then
			
			end
		end
	end
end)

I’m still not sure what you mean by ‘JJ system’ , but just based on this code: the parameter isType is not passed to InputEnded, so you’ll need something like this:

UIS.InputEnded:Connect(function(input)
    -- If it’s a keyboard input
    if input.UserInputType == Enum.UserInputType.Keyboard then
        -- If an input is *not* needed (?)
        if inputNeeded == false then
            -- If it’s a jump
            if input.KeyCode == Enum.KeyCode.Space then
                 print(‘It works!)
            end
        end
    end
end)

Also have a look at the InputObject docs.

You can use UserInputService.JumpRequest (an event that fires when the player jump) from a local script to see when the player jumps, and wait for a message (Player.Chatted). Then see if the time it took to message is not too long.

Example:

--Local script
local UserInputService = game:GetService("UserInputService")
local plr = game:GetService("Players").LocalPlayer
local maxTimeForAction = 0.5 --When players jump/chat, they'll have half a second to jump/chat (like first jump and then chat, or vice versa)

UserInputService.JumpRequest:Connect(function() --When a player tries to jump
    local currentTime = tick() --Get the time
    local msg = plr.Chatted:Wait() --Wait until the player chats
    if tick()-currentTime <= maxTimeForAction then
        --If player jumped and chatted at the same time
        --System/Game Logic here
    end
end)
plr.Chatted:Connect(function() -- When a player chats
    local currentTime = tick() --Get the time
    local msg = UserInputService.JumpRequest:Wait() --Wait until the player jumps
    if tick()-currentTime <= maxTimeForAction then
        --If player chatted and jumped at the same time
        --System/Game Logic here
    end
end)


@regibus361 Yes it is passed. There’s a parameter called “gameProcessedEvent”.
It is also in the link you’ve mentioned.

It basically determines whether the player just pressed a key, or is in a process (chatting, clicking a GUI Button/TextBox).

OP added the IsType check to make sure the player presses the space bar without chatting or etc.

1 Like

Jumping Jacks?

Like when you jump then stop jumping you have to say the number or whatever?

This works, thanks! (thirtycharacterlimit)