Hi. I have a problem with my objective script.
Basically, what I want is the objective to sort of typewriter itself and disappear.
But for some reason, the text does not typewrite. It plays the sound and everything, no errors.
Typewriter script:
local function typewriter(s, label, soundFX)
local newString
for i = 0, s:len(), 1 do
newString = s:sub(1, i)
soundFX:Play()
wait(0.02)
if s:sub(i-1, i-1) == "," then
wait(0.1)
elseif s:sub(i-1, i-1) == "." then
wait(0.4)
elseif s:sub(i-1, i-1) == "!" then
wait(0.5)
elseif s:sub(i-1, i-1) == "?" then
wait(0.3)
end
label.Text = newString
wait()
end
end
You should first check if āsā actually holds any value. Try printing it above your ālocal newStringā line and if it does have a string value then check if your label is matching and if the script is on the client and not on the server.
local function typewriter(s : string, label : TextLabel, soundFX : Sound)
for i=1, string.len(s) do
local text = string.sub(s, 1, i)
label.Text = text
if string.sub(s, i, i) ~= " " and soundFX then
soundFX:Play()
end
if string.sub(s, i, i) == "," then
task.wait(0.3)
elseif string.sub(s, i, i) == "." then
task.wait(0.4)
elseif string.sub(s, i, i) == "!" then
task.wait(0.5)
elseif string.sub(s, i, i) == "?" then
task.wait(0.3)
else
task.wait(0.05)
end
end
end
OK! New problem. Iāve updated the typewriter script. Still isnāt working lol
Typewriter script:
local function typewriter(stringValue, label, soundFX, slowness)
for i = 1, #stringValue do
label.Text = string.sub(stringValue, 1, i)
wait(slowness/100)
soundFX:Play()
end
wait(slowness*40)
end
My objective script doesnāt seem to be working. The thing is, the function carries out normally, but the frame doesnāt tween at ALL.
Objective script:
local function giveObjective(objective)
objectiveFrame.Visible = true
objectiveFrame:TweenSize(UDim2.new(0.6,0,0.15,0), "Out", "Quint", 0.1)
typewriter(objective, objectiveLabel, game.SoundService.SND_TXT1, 5)
objectiveFrame:TweenSize(UDim2.new(0,0,0.15,0), "Out", "Quint", 0.1)
wait(0.1)
objectiveFrame.Visible = false
end
Sorry, my code is kinda private. Iām dicey about giving it away. Could you find a backdoor as these are the core components of the ObjectiveGUI?
Also itās about 700 lines lol