RobloxScripterAI
Discord ↗
Link Copied to Clipboard
×
"create a add friend gui and add a feature to search for players make it very complex"
-- LocalScript in a TextButton local button = script.Parent local playerService = game:GetService("Players") local textBox = button.Parent.TextBox button.MouseButton1Click:Connect(function() local playerName = textBox.Text local player = playerService:FindFirstChild(playerName) if player then local success, message = pcall(function() playerService.LocalPlayer:RequestFriendship(player) end) if success then print("Friend request sent to " .. playerName) else print("Failed to send friend request: " .. message) end else print("Player " .. playerName .. " not found.") end end) -- LocalScript in a TextBox local textBox = script.Parent local playerService = game:GetService("Players") textBox.FocusLost:Connect(function(enterPressed) if enterPressed then local playerName = textBox.Text local player = playerService:FindFirstChild(playerName) if player then print("Player " .. playerName .. " found.") else print("Player " .. playerName .. " not found.") end end end)