Simple closed captions system

Yeah that’s something I’m struggling with lately. :confused:
Is that public? I’d love to have a nosey

It’s not public, but here is a part of the code, it’s not that good

function module.Question(Question,FirstChoice,SecondChoice)
	local ReturnValue = nil
	ChoicesGui.Enabled = true

	QuestionText.Text = Question
	FirstChoiceButton.Text = FirstChoice
	SecondChoiceButton.Text = SecondChoice

	FirstChoiceButton.MouseButton1Click:Connect(function()
		ChoicesGui.Enabled = false
		ReturnValue = 1
	end)
	SecondChoiceButton.MouseButton1Click:Connect(function()
		ChoicesGui.Enabled = false
		ReturnValue = 2
	end)

	repeat wait() until ReturnValue
	if ReturnValue == 1 then
		ChatService:Chat(LocalPlayerChar, FirstChoice)
	elseif ReturnValue == 2 then
		ChatService:Chat(LocalPlayerChar, SecondChoice)
	end
	return ReturnValue
end
1 Like

Nice work. Does this support rich text?

1 Like

No, at least not yet. Didn’t think of that

Extremely useful, this will help my game more accessible. :slight_smile:

1 Like

It dosent look like the captions can be auto translated

Do this.

local ServiceDeLocalization = game:GetService("LocalizationService")

function ClosedCaptions.Caption(Text, Lifespan)
	local _Traduire : Translator = ServiceDeLocalization:GetTranslatorForPlayer(game:GetService("Players").LocalPlayer)

	local _TexteTraduire = _Traduire:Translate(game, Text)
	
	local Caption = CreateCaption()
	
	Caption.Text = _TexteTraduire
	CleanCaption(Caption, Lifespan)
end
1 Like

Thanks for the help! But it dosent seem to do anything

What’s your locale? You can use locale for translating instead.

I don’t know why your getting that message, Did you use the showcase yet?

Sorry, I resolved it myself. Forgot to delete the post.