ok so in my game a story game i have first a intro to the story for each part of the story what have much text i have a script translator get working its handfull if you need the translator script here
local UIS = game:GetService("UserInputService")
if UIS.TouchEnabled then
script.Parent.TextSize = 15
elseif UIS.GamepadEnabled then
script.Parent.TextSize = 50
elseif UIS.KeyboardEnabled then
script.Parent.TextSize = 30
end
local player = game:GetService("Players").LocalPlayer
local name = player.Name
--local langouge = game:GetService("LocalizationService")
--script.Parent.Text = "<b> hi there "..name.." welcome to the great plain we are now in the midle of nowhere i will tell yo a story </b> <br></br><br></br> <h1><b> prof unviere</b></h1><br></br><br></br> im prof unviere and so as you know they build up a city here in the great plain with my inventions but i have made somthing to stop them i dont have much time but i hope you get this letter from me sincerly prof un....<br></br><br></br><b>this chapter</b><br></br><br></br> the great plain was in the past all nature but now they build a city here you will in this chapter ask the residents here to prof blocks but on your way dangerous things will hapen and o somwhere else you need to build up a fort to survive the creatures there i wish you good luck in the muliverse<br></br><br></br>sincerely the unviere games team"
local LocalizationService = game:GetService("LocalizationService")
local Players = game:GetService("Players")
local res, translator = pcall(function()
return LocalizationService:GetTranslatorForPlayerAsync(player)
end)
-- Function to update localized assets
local function UpdateLocalizedAssets(translator)
-- Example: Translating a UI text label
local textLabel = script.Parent
--if textLabel then
if translator.LocaleId == "nl-nl" then
textLabel.Text = "<b> Hallo daar, "..name.." welkom in de groote vlaktes. We zijn nu in niemands land, ik ga je een verhaal vertellen. </b> <br></br><br></br> <h1><b> Prof Unviere</b></h1><br></br><br></br> Beste, "..name.." <br></br><br></br> ik ben Prof Unviere en zoals je waarschijnelijk al weet, ze bouwen een stad hier in de groote vlaktes. Met mijn uitvindingen. Maar, ik heb iets gemaakt, om ze te stoppen. Ik heb niet alle tijd van de wereld, dus ik hoop dat je deze brief van me krijgt. <br></br> Met vriendelijke groet Prof Un... <br></br><br></br><b>in dit hoofdstuk</b><br></br><br></br> De groote vlakte was vroeger vol met natuur. maar, ze bouwen een stad hier. In dit hoofdstuk, vraag je de bewoners of ze Prof Unviere hebben gezien. maar, het is gevaarlijk en o, Op en andere plaats. Moet je een vort bouwen om de wezens, die daar leven, te overleven. Ik wens je veel geluk in de multiversum! <br></br><br></br>Met vriendelike groet het unviere games team!"
-- translator:Translate("<b> Hallo daar, "..name.." welkom in de groote vlaktes. We zijn nu in niemands land, ik ga je een verhaal vertellen. </b> <br></br><br></br> <h1><b> Prof Unviere</b></h1><br></br><br></br> Beste, "..name.." <br></br><br></br> ik ben Prof Unviere en zoals je waarschijnelijk al weet, ze bouwen een stad hier in de groote vlaktes. Met mijn uitvindingen. Maar, ik heb iets gemaakt, om ze te stoppen. Ik heb niet alle tijd van de wereld, dus ik hoop dat je deze brief van me krijgt. <br></br> Met vriendelijke groet Prof Un... <br></br><br></br><b>in dit hoofdstuk</b><br></br><br></br> De groote vlakte was vroeger vol met natuur. maar, ze bouwen een stad hier. In dit hoofdstuk, vraag je de bewoners of ze Prof Unviere hebben gezien. maar, het is gevaarlijk en o, Op en andere plaats. Moet je een vort bouwen om de wezens, die daar leven, te overleven. Ik wens je veel geluk in de multiversum! <br></br><br></br>Met vriendelike groet het unviere games team!")
else
textLabel.Text = "<b> Hi there, "..name.." welcome to the great plain. We are now in the midle of nowhere, i will tell you a story. </b> <br></br><br></br> <h1><b> Prof Unviere</b></h1><br></br><br></br> Dear, "..name.." <br></br><br></br> im Prof Unviere and so as you know, they build up a city here in the great plain. With my inventions. But i have made somthing to stop them. I dont have much time but, I hope you get this letter from me. Sincerly Prof Un....<br></br><br></br><b>this chapter</b><br></br><br></br> The great plain was in the past all nature. But now they build a city here. You will in this chapter ask the residents here where Prof Unviere is. But on your way dangerous things will hapen. And o somwhere else, you need to build up a fort to survive the creatures there. I wish you good luck in the muliverse<br></br><br></br>Sincerely the unviere games team!"
--end
end
-- Add more asset translation logic as needed
end
-- Function that gets called when change in player's locale ID is detected
local function OnLocaleIdChanged()
print("Translator has changed to: " .. translator.LocaleId)
-- You should re-translate any assets translated with Localization APIs to the player's new language here
-- Example: Update UI text or other localized assets
-- Assuming you have a function `UpdateLocalizedAssets` to handle this
UpdateLocalizedAssets(translator)
end
-- Check if GetTranslatorForPlayerAsync succeeded
if res then
-- If succeeded, translate assets here using translator
UpdateLocalizedAssets(translator)
-- Listen for a change in player's locale ID
translator:GetPropertyChangedSignal("LocaleId"):Connect(OnLocaleIdChanged)
else
print('GetTranslatorForPlayerAsync failed: ' .. translator)
end
but now i have a nother script two one that checks for an atribute active if false it shows an error whith story is in process so you need to folow it first
local atribute1 = script.Parent.next
local storyprompt = nil
local err = script.Parent.Parent.Parent.error
local function isactive()
if atribute1:GetAttribute("active") == true then
atribute1.Image = "rbxassetid://17408653736"
atribute1.text.TextColor3 = Color3.new(0.560784, 0.898039, 0.929412)
elseif atribute1:GetAttribute("active") == false then
atribute1.Image = "rbxassetid://17408669967"
atribute1.text.TextColor3 = Color3.new(0.666667, 0.666667, 0.498039)
end
end
atribute1.MouseButton1Click:Connect(function()
if atribute1:GetAttribute("active") == false then
err.Visible = true
task.wait(5)
err.Visible = false
end
end)
atribute1.MouseButton1Click:Connect(function()
if atribute1:GetAttribute("active") == true then
script.Parent.Parent.Parent.Parent.start.Visible = false
-- proceed story atributes here
end
end)
atribute1:GetAttributeChangedSignal("active"):Connect(isactive)
isactive()
well than here the graphemes loop it stops when it reach 807 i checked in properties
and the check for the active atribute doesnt work either if i call it after the loop
local atribut1 = script.Parent.Parent.Parent.Parent.right.next
local function typewritter()
script.Parent.MaxVisibleGraphemes = 0
atribut1:SetAttribute("active", false)
if script.Parent.Visible == true then
--for x = 1, 20 do
--script.Parent.MaxVisibleGraphemes += 1
--task.wait(0.01)
--end
--end
--end
local function removeTags(str)
-- replace line break tags (otherwise grapheme loop will miss those linebreak characters)
str = str:gsub("<br%s*/>", "\n")
return (str:gsub("<[^<>]->", ""))
end
local displayText = removeTags(script.Parent.LocalizedText)
local index = 0
for first, last, complete in utf8.graphemes(displayText) do
local grapheme = displayText:sub(first, last)
index += 1
-- Uncomment this statement to get a reveal effect that ignores spaces.
if grapheme ~= " " then
script.Parent.MaxVisibleGraphemes = index
task.wait()
end
if complete then
atribut1:SetAttribute("active", true)
end
end
end
end
script.Parent.Parent.Parent.Parent.Parent.Parent.start:GetPropertyChangedSignal("Visible"):Connect(typewritter)
typewritter()
All help is appreciated
