0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

robloxでassistant その22

Last updated at Posted at 2024-05-09

概要

robloxでassistantやってみた。
練習問題やってみた。

練習問題

zundokoを表示せよ。

写真

image.png

サンプルコード

local player = game.Players.LocalPlayer
local PlayerGui = player:WaitForChild("PlayerGui")
local gui = PlayerGui:WaitForChild("ScreenGui")

gui.TextButton.MouseButton1Click:Connect(function()
	local zundoko = {"ズン", "ドコ"}
	local sequence = {}
	local res = ""
	local function checkZundoko(sequence)
		local n = #sequence
		if n < 5 then
			return false
		end
		for i = 1, n - 4 do
			if sequence[i] == "ズン" and sequence[i+1] == "ズン" and sequence[i+2] == "ズン" and sequence[i+3] == "ズン" and sequence[i+4] == "ドコ" then
				return true
			end
		end
		return false
	end
	while not checkZundoko(sequence) do
		local randomIndex = math.random(1, 2)
		table.insert(sequence, zundoko[randomIndex])
		res ..= zundoko[randomIndex]
	end
	res ..= "キ・ヨ・シ!"
	gui.TextBox.Text = res
end)




以上。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?