My Textbox script doesn't working

1- My textbox script is not working, just space.

2-

It’s saying “textLabel.Text = yazilanMetin” error

aa.Touched:Connect(function()
	if db == false then
		db = true
		plr.PlayerGui.Diyalog.yduh.Frame1.Visible = true
		local mesaj = msges[math.random(1 , #msges)]
		local yazilanMetin = ""
		for i = 1, #mesaj do
			yazilanMetin = yazilanMetin .. string.sub(mesaj, i, i)
			textLabel.Text = yazilanMetin
			wait()
		end
	end
end)

3- I tried make it normal script and local script also tried on chat gpt

Since yazilanMetin is just an empty string, you can just do this:

textLabel.Text = string.sub(mesaj, i, i)

Also what does the error say exactly?

it’s says-
sdasad

That isnt an error, what does the error say? if there even is one?

oh sorry this one?

That means Textlabel is nil, are you using WaitForChild? to wait for the Item?

Can you send all of your script?

PS: I put some lines for fixing
Test this:

local plr = game.Players.LocalPlayer
local frame1 = plr:WaitForChild("PlayerGui").Diyalog.yduh.Frame1
local db = db or false
local msges = msges or {[1]="Fix your msges variable!"}
local textLabel = textLabel or frame1:FindFirstChildOfClass("TextLabel")
aa.Touched:Connect(function()
	if db == false then
		db = true
		frame1.Visible = true
		local mesaj = msges[math.random(1 , #msges)]
		local yazilanMetin = ""
		for i = 1, string.len(mesaj) do
			yazilanMetin = yazilanMetin .. string.sub(mesaj, i, i)
			textLabel.Text = yazilanMetin
			wait()
		end
	end
end)

yes I did also tried findfirstchild too

local aa = game.Workspace:WaitForChild("kapi").b
local db = false
local plr = game.Players.LocalPlayer
local gui = plr.PlayerGui.Diyalog.yduh.Frame1
local textLabel = gui:WaitForChild("TextLabel") -- TextLabel nesnesini bulun


local msges = {
	"Welcome!!! , how's going",
	"yo",
	"What's up",
	"Don't dare to steal something",
	"Welcome again"

}

local function swooshSound()
	local sound = Instance.new("Sound",game.ReplicatedStorage)
	sound.PlaybackSpeed = 1
	sound.Volume = 1
	sound.PlayOnRemove = true
	sound.SoundId = "rbxassetid://4845387138"
	sound:Destroy()
end

aa.Touched:Connect(function()
	if db == false then
		db = true
		plr.PlayerGui.Diyalog.yduh.Frame1.Visible = true
		local mesaj = msges[math.random(1 , #msges)]
		local yazilanMetin = ""
		for i = 1, #mesaj do
			yazilanMetin = yazilanMetin .. string.sub(mesaj, i, i)
			textLabel.Text = yazilanMetin
			wait()
		end


	end
end)

This is the full script

Have you create A ScreenGui named “Diyalog” inside there are a frame called “yduh” inside there are a frame called “Frame1” inside a TextLabel?

Because i have test your script it’s works me.

Tested script:

local db = false
local plr = game.Players.LocalPlayer
local gui = plr.PlayerGui.Diyalog.yduh.Frame1
local textLabel = gui:WaitForChild("TextLabel") -- TextLabel nesnesini bulun


local msges = {
	"Welcome!!! , how's going",
	"yo",
	"What's up",
	"Don't dare to steal something",
	"Welcome again"

}

local function swooshSound()
	local sound = Instance.new("Sound",game.ReplicatedStorage)
	sound.PlaybackSpeed = 1
	sound.Volume = 1
	sound.PlayOnRemove = true
	sound.SoundId = "rbxassetid://4845387138"
	sound:Destroy()
end
wait(1)
if db == false then
	db = true
	plr.PlayerGui.Diyalog.yduh.Frame1.Visible = true
	local mesaj = msges[math.random(1 , #msges)]
	local yazilanMetin = ""
	for i = 1, #mesaj do
		yazilanMetin = yazilanMetin .. string.sub(mesaj, i, i)
		textLabel.Text = yazilanMetin
		wait()
	end


end

Yes I did.

what is the instance inside TextLabel?

Oh I forgat about local gui I added it to waitforchild now it is working thank you.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.