Prints nothing while i am trying to print position of input

so i am trying to make a vr game and i need position of input to move a finger of the player, but when im trying to do it it just prints nothing, heres the code:

local UserInputService = game:GetService("UserInputService")

UserInputService.InputChanged:Connect(function(input, gameProcessedEvent)
	if gameProcessedEvent then return end
	if input.KeyCode == Enum.KeyCode.ButtonR2 then
		print(input.Position.Z)
	end
end)

tried everything, printing the keycode of the input, parenting the script to starterplayercharacter, starterplayerscripts, startergui, everything(this is a local script)

Hey, reading your code it appears you’re attempting to get how pressed down the trigger is, correct?

Like, you’re trying to get 3 different outputs for all these:
Expected Output: 0

Expected Output: ~0.4

Expected Output: 1

Unfortunately I don’t believe roblox supports this. The trigger is either down or up, no inbetweens.

try if not gameProcessedEvent, that property is VERY iffy for me and might not even exist for VR controls

yeah but how other games do it? its should be possible if others can do it(i think)

sadly, it didnt work, i tried it already

Other games (on roblox) don’t do it. What they do though is tween/lerp values when activated for smooth transitions.

Roblox input states are either down or up.

Apologies for the late response.

ive seen many vr games do it, like when i try to hold R1 but not fully in some vr games its going to be in the middle, and i think they used InputChanged

no worries for late response, i have strange timezone

If by “other VR games” you mean games like Bonelab, Boneworks, VRChat etc, the reason they can do it is because they aren’t on roblox. Usually, the inputs would be passed through, this is just a stupid limitation roblox has, and has had forever.

Every roblox game I’ve played in VR has had these same limitations, and playing on controller has the same limitations. There is no way (at least from my testing a few years back) to get how pressed down a trigger is.

no, i mean games in roblox like VR hangout, they do it somehow

What happens if you remove the if gameProcessedEvent then and/or use InputBegan instead of InputChanged

My bad, I was actually wrong here. Somethings changes since I last tested or I did barely any research. Last time I saw anyone ask about this was on the VR Hands server, where someone said it wasn’t possible. With how stupid the roblox engine is at times, I assumed it was true for all this time.

Here’s code that worked for me:

game:GetService("UserInputService").InputChanged:Connect(function(inputObject, gameProcessedEvent)
	if inputObject.KeyCode == Enum.KeyCode.ButtonR2 then
		print(inputObject.Position.Z)
	end
end)

I did test this with an XBOX controller (since with me using a Vive, the openXR settings for roblox are broken), so I’m not sure how it’ll work in VR.

I do have a theory that you having gameProcessedEvent returning is what cancelled it from printing, as all results I found from a quick search don’t have it.

Okay! lemme try it in studio(i am sorry FOR THE LAAAAAATE response)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.