2 Buttons for ProximityPrompt?

Is it possible to add 2 buttons to a Proximity Prompt? I tried making an attempt but it’s not working, nothing is being output, is there any explanation as to why? If it isnt possible then I’m going to have to use a billboard gui.

My code(script inside of a ProximityPrompt)

local UserInputService = game:GetService("UserInputService")
local Players = game:GetService("Players")
local Player = Players.LocalPlayer
local Part = script.Parent.Parent
local ProximityPrompt = script.Parent




local EatKey = Enum.KeyCode.X
local CarryKey = Enum.KeyCode.Z




ProximityPrompt.Triggered:Connect(function(player)
	UserInputService.InputBegan:Connect(function(input)
		if input.KeyCode == EatKey then
			print("Ate Food")
			
		elseif input.KeyCode == CarryKey then
			print("Carried Food")
		end
	end)
end)

image

is this a server or local script

Server Script inside of a proximityprompt

image

i don’t think userinputservice works for server side scripts

1 Like

From my experience with proximity prompts, they currently dont have the ability to take in two inputs.

Looking at the system you have right now, an idea is to have the proximity prompt only take the Z input of carrying, then have the water in the players inventory, then in order for the player to drink it, they would have it in their inventory and press a key while equiped to drink.

Hope this Helps!

1 Like

Your code has to be in a local script

Makes sense, I transferred the code over to a local script but the same problem is occuring, nothing is being output and its not printing (“ate food”) or (“carried food”)

i think it’s because it detects the trigger and you not the input before it’s triggered

1 Like

Thats a bummer I’m probably going to head in the direction of your idea, thank you for the idea.

1 Like

That makes sense, I’m just gonna probably use a billboard gui since its less hassle.

No problem at all, and sorry to hear your first idea didn’t go as planned.

Have a great day!

1 Like

Yoy can use proximity primpt just simply seperate the events. Dont pu the user input event insde the proximity function.

Local zpressed = false
Userinput.blah.(function
     If input is z then
        Zpressed = true
     End)
End)

Im working rn cant give you fill code but this should give you idea

1 Like

https://developer.roblox.com/en-us/api-reference/function/ProximityPrompt/InputHoldBegin

A lot of misinformation in this thread. You can emulate the prompt’s input being held by calling the above method.