RobloxScripterAI
Discord ↗
Link Copied to Clipboard
×
"make rock paper scissors"
-- local script for rock paper scissors game local player = game.Players.LocalPlayer local mouse = player:GetMouse() local screenGui = Instance.new("ScreenGui") screenGui.Parent = player.PlayerGui local frame = Instance.new("Frame") frame.Size = UDim2.new(0,200,0,200) frame.Position = UDim2.new(0.5,-100,0.5,-100) frame.BackgroundColor3 = Color3.new(0,0,0) frame.BackgroundTransparency = 0.5 frame.Parent = screenGui local rock = Instance.new("TextButton") rock.Text = "Rock" rock.Size = UDim2.new(0,100,0,50) rock.Position = UDim2.new(0.5,-50,0.2,0) rock.Parent = frame local paper = Instance.new("TextButton") paper.Text = "Paper" paper.Size = UDim2.new(0,100,0,50) paper.Position = UDim2.new(0.5,-50,0.4,0) paper.Parent = frame local scissors = Instance.new("TextButton") scissors.Text = "Scissors" scissors.Size = UDim2.new(0,100,0,50) scissors.Position = UDim2.new(0.5,-50,0.6,0) scissors.Parent = frame local result = Instance.new("TextLabel") result.Size = UDim2.new(0,200,0,50) result.Position = UDim2.new(0.5,-100,0.8,0) result.Parent = frame local function playGame(choice) local computerChoice = math.random(1,3) if computerChoice == 1 then result.Text = "Computer chose Rock" if choice == "Rock" then result.Text = "Tie!" elseif choice == "Paper" then result.Text = "You win!" elseif choice == "Scissors" then result.Text = "You lose!" end elseif computerChoice == 2 then result.Text = "Computer chose Paper" if choice == "Rock" then result.Text = "You lose!" elseif choice == "Paper" then result.Text = "Tie!" elseif choice == "Scissors" then result.Text = "You win!" end elseif computerChoice == 3 then result.Text = "Computer chose Scissors" if choice == "Rock" then result.Text = "You win!" elseif choice == "Paper" then result.Text = "You lose!" elseif choice == "Scissors" then result.Text = "Tie!" end end end rock.MouseButton1Click:Connect(function() playGame("Rock") end) paper.MouseButton1Click:Connect(function() playGame("Paper") end) scissors.MouseButton1Click:Connect(function() playGame("Scissors") end)