RobloxScripterAI
Discord ↗
Link Copied to Clipboard
×
"create rock paper sicssors"
-- local script (StarterGUI) local player = game.Players.LocalPlayer local screenGui = Instance.new("ScreenGui", player.PlayerGui) local background = Instance.new("Frame", screenGui) background.BackgroundColor3 = Color3.fromRGB(0, 0, 0) background.Size = UDim2.new(1, 0, 1, 0) local rockButton = Instance.new("TextButton", background) rockButton.Text = "Rock" rockButton.TextColor3 = Color3.fromRGB(255, 255, 255) rockButton.BackgroundColor3 = Color3.fromRGB(0, 0, 0) rockButton.Position = UDim2.new(0.3, 0, 0.5, 0) rockButton.Size = UDim2.new(0.1, 0, 0.1, 0) local paperButton = Instance.new("TextButton", background) paperButton.Text = "Paper" paperButton.TextColor3 = Color3.fromRGB(255, 255, 255) paperButton.BackgroundColor3 = Color3.fromRGB(0, 0, 0) paperButton.Position = UDim2.new(0.45, 0, 0.5, 0) paperButton.Size = UDim2.new(0.1, 0, 0.1, 0) local scissorsButton = Instance.new("TextButton", background) scissorsButton.Text = "Scissors" scissorsButton.TextColor3 = Color3.fromRGB(255, 255, 255) scissorsButton.BackgroundColor3 = Color3.fromRGB(0, 0, 0) scissorsButton.Position = UDim2.new(0.6, 0, 0.5, 0) scissorsButton.Size = UDim2.new(0.1, 0, 0.1, 0) local resultLabel = Instance.new("TextLabel", background) resultLabel.Text = "Result:" resultLabel.TextColor3 = Color3.fromRGB(255, 255, 255) resultLabel.BackgroundColor3 = Color3.fromRGB(0, 0, 0) resultLabel.Position = UDim2.new(0.45, 0, 0.7, 0) resultLabel.Size = UDim2.new(0.1, 0, 0.1, 0) local function play(playerChoice) local choices = {"Rock", "Paper", "Scissors"} local computerChoice = choices[math.random(1, 3)] if playerChoice == computerChoice then return "Draw" elseif (playerChoice == "Rock" and computerChoice == "Scissors") or (playerChoice == "Paper" and computerChoice == "Rock") or (playerChoice == "Scissors" and computerChoice == "Paper") then return "Player Wins" else return "Computer Wins" end end rockButton.MouseButton1Click:Connect(function() resultLabel.Text = "Result: " .. play("Rock") end) paperButton.MouseButton1Click:Connect(function() resultLabel.Text = "Result: " .. play("Paper") end) scissorsButton.MouseButton1Click:Connect(function() resultLabel.Text = "Result: " .. play("Scissors") end)