Help with wait() and making it wait for specific parameters

I want to use :Wait() to make it wait for a specific parameter
like if I wanted it to wait for a signal with “A” as the parameters

game.ProximityPromptService.Triggered:Wait("A") -- I want it to wait for it to fire A 

RBXScriptSignal::Wait does not utilize parameters because it already returns the values fired to the event:

local returnedValue = game.ProximityPromptService.Triggered:Wait()
print(returnedValue)

It multiple values are returned, define multiple variables at once:

local v1, v2 = game.ProximityPromptService.Triggered:Wait()

Something like this?

repeat
    local a = game.ProximityPromptService.Triggered:Wait()
until a == "A"
local A = game.ProximityPromptService.Triggered:Wait()

oh mb, been working with like 5 different languages recently, not fun switching between them :sweat_smile:

Haha, I totally get that; If you ever need help, refer to the API docs or here! We’re always happy to help! :smile:

This still leaves the question how would I wait for specific parameters with events

You can’t wait for specific parameters, when the event fires, it sends everything.

You’ll need a loop.

local result
repeat
    result = game.ProximityPromptService.Triggered:Wait()
until result == "A"
1 Like

https://developer.roblox.com/en-us/api-reference/event/ProximityPromptService/PromptTriggered
This won’t work as both of Triggered's return values are instances, not strings.

local Game = game
local ProximityPromptService = Game:GetService("ProximityPromptService")
local BindableEvent = Instance.new("BindableEvent")

local function OnTriggered(Prompt, Player)
	--Do code.
	if true then --'true' would be replaced with a condition.
		BindableEvent:Fire()
	end
end

ProximityPromptService.OnTriggered:Connect(OnTriggered)
BindableEvent.Event:Wait() --Wait for the 'BindableEvent' object to be fired.
1 Like

wow that is a great solution thank you