Assigning an additional parameter to a bindable callback?

I’m making a ;help system for a game that makes use of Roblox’s SendNotification CoreGUI feature. The way it works is that every time a player in-game requests a moderator with the ;help command, the server fires to each moderator’s client that lets the SendNotification CoreGUI pop-up with the stated reason and the player username.

Functionality with the pop-up has been established, but my issue lays in how I’ll pass on the player who requested onto the BindableFunction.

bindable.OnInvoke = function(response)
	if response == "Teleport" then
		local targetCharacter = currentRequest.Character;
		local endCf = targetCharacter.HumanoidRootPart.CFrame;
		endCf += (endCf.LookVector * 2);

		character.HumanoidRootPart.CFrame = endCf;
	end
end

helpEvent.OnClientEvent:Connect(function(plr, reason)
	reason = reason or "No reason provided.";
	
	
	currentRequest = game.Players:FindFirstChild(plr);
	local playerIcon, ready = game:GetService("Players"):GetUserThumbnailAsync(
		currentRequest.UserId, 
		Enum.ThumbnailType.HeadShot, 
		Enum.ThumbnailSize.Size48x48);
	
	local timeout: number = 0;
	
	repeat game:GetService("RunService").RenderStepped:Wait(); timeout += 0.5; until ready or timeout > 550;
	
	starterGui:SetCore("SendNotification", {
		Title = plr,
		Text = reason,
		Icon = playerIcon,
		Duration = 20,
		Callback = bindable,
		Button1 = "Teleport",
		Button2 = "Ignore"
	})
end)

This is my code above, and my temporary workaround at the moment is assigning the latest ;help request to a currentRequest variable, but this isn’t gonna work well if, for example, two or three players ;request at once. If someone clicks ‘Teleport’ on the ;help request of a player, it’ll instead teleport the moderator to the latest requester, but what if the request they accepted was the person before? While it’s a minor inconvenience, it’s still something I’m looking to fix.

1 Like

To answer your question, no, you cannot assign properties to the SetCore “SendNotification.” But you can run your process differently to run how you want.

For me, I run the code as such,

  1. (SERVER) TextChatService detects a message being sent. Checks if message is
    “;help”.
  2. (SERVER) Perform debounce to prevent spamming
  3. (SERVER) Run a pcall “local Succes, Reponse” and Invoke moderators clients
  4. (CLIENT) helpEvent.OnClientEvent runs and returns “Teleport” or “Ignore”
  5. (SERVER) pcall returns the response “Teleport” or Ignore"
  6. (SERVER) if response == “Teleport” then

OR

starterGui:SetCore("SendNotification", {
	Title = plr,
	Text = reason,
	Icon = playerIcon,
	Duration = 20,
	Callback = function()
		
-- can access your local variables from above
		
	end,

	Button1 = "Teleport",
	Button2 = "Ignore"
})
1 Like

Wouldn’t the callback need a BindableFunction? I originally tried using a function first but from what I recall it didn’t work because it needs a BindableFunction

I’ll try out a RemoteFunction as well, though. Completely forgot that was in the equation