Hi, so I and my friend are just adding typewriter text to my game to make it more realistic, the text does work it’s just that we’ve run into a small error for one of them and it’s not working.
Here’s the code the typeWriter text is used in:
local Player = game:GetService("Players").LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")
local Players = game:GetService("Players")
local PlayerModule = require(game.Players.LocalPlayer.PlayerScripts:WaitForChild("PlayerModule"))
local Controls = PlayerModule:GetControls()
local Badge_Service = game:GetService("BadgeService")
local Players = game:GetService("Players")
local BadgeID = 2125784344
local BadgeID1 = 2125784379
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local TypeWriter = require(ReplicatedStorage:WaitForChild('TypeWriter'))
local Prompt = game.Workspace.signupredirectlol.ProximityPrompt
local screengui = game.Players.LocalPlayer.PlayerGui.ScreenGui
local CGUI = game.Players.LocalPlayer.PlayerGui.CGUI
local textt = game.Players.LocalPlayer.PlayerGui.CGUI.textt
local No = game.Players.LocalPlayer.PlayerGui.CGUI.No
local Yes = game.Players.LocalPlayer.PlayerGui.CGUI.Yes
local NResponse = game.Players.LocalPlayer.PlayerGui.CGUI.NResponse
local YResponse = game.Players.LocalPlayer.PlayerGui.CGUI.YResponse
local Frame = game.Players.LocalPlayer.PlayerGui.CGUI.Frame
local money = game.Players.LocalPlayer.PlayerGui.CGUI.Frame.money
local noc = game.Players.LocalPlayer.PlayerGui.CGUI.Frame.noc
Prompt.Triggered:Connect(function()
Prompt.Enabled = false
Controls:Enable(false)
No.Visible = true
Yes.Visible = true
textt.Visible = true
TypeWriter.typeWrite(script.Parent, "Are you here to buy some cheese? We only have one left.")
wait(2)
end)
No.MouseButton1Click:Connect(function()
No.Visible = false
Yes.Visible = false
textt.Visible = false
NResponse.Visible = true
wait(2)
Frame.Visible = true
noc.Visible = true
Badge_Service:AwardBadge(Player.UserId,BadgeID1)
game.ReplicatedStorage.RemoteEvent:FireServer()
wait(2)
print(Player, "ending n")
Player:Kick("Ending: you said no to the clerk")
end)
Yes.MouseButton1Click:Connect(function()
No.Visible = false
Yes.Visible = false
textt.Visible = false
YResponse.Visible = true
wait(2)
Frame.Visible = true
money.Visible = true
Badge_Service:AwardBadge(Player.UserId,BadgeID)
game.ReplicatedStorage.RemoteEvent:FireServer()
wait(2)
print(Player, "ending s")
Player:Kick("Ending: you forgot your money")
end)
Here’s the typeWriter system code:
local SOURCE_LOCALE = "en"
local LocalizationService = game:GetService("LocalizationService")
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local translator = nil
pcall(function()
translator = LocalizationService:GetTranslatorForPlayerAsync(player)
end)
if not translator then
pcall(function()
translator = LocalizationService:GetTranslatorForLocaleAsync(SOURCE_LOCALE)
end)
end
local TypeWriter = {}
local defaultConfigurations = {
delayTime = 0.08,
extraDelayOnSpace = true
}
function TypeWriter.configure(configurations)
for key, value in pairs(defaultConfigurations) do
local newValue = configurations[key]
if newValue ~= nil then
defaultConfigurations[key] = newValue
else
warn(key .. " is not a valid configuration for TypeWriter module")
end
end
end
function TypeWriter.typeWrite(guiObject, text)
guiObject.AutoLocalize = false
guiObject.Text = ""
local displayText = text
if translator then
displayText = translator:Translate(guiObject, text)
end
for first, last in utf8.graphemes(displayText) do
local grapheme = string.sub(displayText, first, last)
guiObject.Text = guiObject.Text .. grapheme
if defaultConfigurations.extraDelayOnSpace and grapheme == " " then
wait(defaultConfigurations.delayTime)
end
wait(defaultConfigurations.delayTime)
end
end
return TypeWriter
Here is the error it is giving us:
Text is not a valid member of ScreenGui “Players.WaterCanxiety.PlayerGui.CGUI”