I want to make a custom friend request screen like this but I don’t know how this even works, because I am assuming this has to do with CoreScripts.
I think that you could have something like this. When the player joins, clone a button for each player in the game, and name that button with that player’s name. Then when a player joins, also make a new button.
Local Script, child of a frame in a ScreenGUI in StarterGui. Make sure to add a ui list layout to the frame too.
local function checkForPress(button)
button.Activated:Connect(function()
game:GetService("StarterGui"):SetCore("PromptSendFriendRequest", game.Players[button.Name])
end)
end
for i, v in pairs(game.Players:GetPlayers()) do
if v.Name ~= game.Players.LocalPlayer.Name then
local button = Instance.new("Button", script.Parent)
button.Name = v.Name
checkForPress(button)
end
end
game.Players.PlayerAdded:Connect(function(player)
local button = Instance.new("Button", script.Parent)
button.Name = player.Name
checkForPress(button)
end)
game.Players.PlayerRemoving:Connect(function(player)
local button = script.Parent:FindFirstChild(player.Name)
if button then
button:Destroy()
end
end)
Also I have to go right now, if this doesn’t work I can help you more tomorrow.
Y’know you really didn’t have to write all that code for me,
No problem, I just hope it helps! I used this article to help me, but if it doesn’t work I probably miss understood how to use the Friendrequest prompts.
Do you have any tips on how to learn lua advanced because I am just stuck on the basics and I feel like I haven’t improved
Remind me tomorrow and I can definitely give you good tips. Also feel free to dm me anytime you have any questions.