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.