Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Players = game:GetService("Players")
- local InsertService = game:GetService("InsertService")
- -- Buat UI
- local screenGui = Instance.new("ScreenGui")
- screenGui.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui")
- local frame = Instance.new("Frame")
- frame.Size = UDim2.new(0, 300, 0, 150)
- frame.Position = UDim2.new(0.5, -150, 0.5, -75)
- frame.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
- frame.Active = true
- frame.Draggable = true -- Bisa dipindah
- frame.Parent = screenGui
- local usernameBox = Instance.new("TextBox")
- usernameBox.Size = UDim2.new(0.8, 0, 0, 30)
- usernameBox.Position = UDim2.new(0.1, 0, 0.2, 0)
- usernameBox.PlaceholderText = "Masukkan Username..."
- usernameBox.Parent = frame
- local copyButton = Instance.new("TextButton")
- copyButton.Size = UDim2.new(0.8, 0, 0, 30)
- copyButton.Position = UDim2.new(0.1, 0, 0.5, 0)
- copyButton.Text = "Copy Avatar"
- copyButton.Parent = frame
- local closeButton = Instance.new("TextButton")
- closeButton.Size = UDim2.new(0.2, 0, 0, 30)
- closeButton.Position = UDim2.new(0.8, -10, 0, -10)
- closeButton.Text = "X"
- closeButton.Parent = frame
- -- Fungsi untuk Copy Avatar
- copyButton.MouseButton1Click:Connect(function()
- local username = usernameBox.Text
- local success, userId = pcall(function()
- return Players:GetUserIdFromNameAsync(username)
- end)
- if success and userId then
- local humanoidDescription = Players:GetHumanoidDescriptionFromUserId(userId)
- local character = Players.LocalPlayer.Character
- if character and character:FindFirstChild("Humanoid") then
- character.Humanoid:ApplyDescription(humanoidDescription)
- end
- else
- warn("Username tidak ditemukan!")
- end
- end)
- -- Fungsi untuk Menutup UI
- closeButton.MouseButton1Click:Connect(function()
- screenGui:Destroy()
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement