【Roblox】NPCと会話

local prompt = script.Parent
local count = 0

function onTrigger(player : Player)
	local npc = script.Parent.Parent
	local head = npc.Head
	
	if count == 0 then
		game.Chat:Chat(head, "山の方にお宝があるらしい")
	elseif count == 1 then
		game.Chat:Chat(head, "何があるのか気になるなあ")
	end
	count += 1
	if count >= 2 then
		count = 0
	end
end

prompt.Triggered:Connect(onTrigger)
local prompt = script.Parent
local count = 0

function onTrigger(player : Player)
	local npc = script.Parent.Parent
	local head = npc.Head
	
	if count == 0 then
		game.Chat:Chat(head, "この先にお宝があるらしい")
	elseif count == 1 then
		game.Chat:Chat(head, "気をつけてすすめ")
	end
	count += 1
	if count >= 2 then
		count = 0
	end
end

prompt.Triggered:Connect(onTrigger)