I don't know what the title should be

Basically what I’m trying to do is when a character is added, It checks if a value is above one, then it will teleport the player, But it didn’t work with no errors. I tried removing the wait, It didn’t work. And i tried using a while loop but it did everything else except teleport the player?

local plr = game.Players.LocalPlayer
local BaguetteEaten = plr:WaitForChild("BaguetteEaten")
local char = plr.Character or plr.CharacterAdded:Wait()
local Root = char:WaitForChild("HumanoidRootPart")
local LT = plr.PlayerGui.DialogGui.Baguette3


plr.CharacterAdded:Connect(function()
	if plr:WaitForChild("BaguetteEaten").Value == 1 then
		wait(7)
		Root.CFrame = game.Workspace.CFrames.BaggueteDied.CFrame
		wait(1)
		LT.TextTransparency = 0
		LT.Text = "So"
		wait()
		LT.Text = "So y"
		wait()
		LT.Text = "So yo"
		wait()
		LT.Text = "So you"
		wait()
		LT.Text = "So you a"
		wait()
		LT.Text = "So you al"
		wait()
		LT.Text = "So you als"
		wait()
		LT.Text = "So you also"
		wait()
		LT.Text = "So you also a"
		wait()
		LT.Text = "So you also at"
		wait()
		LT.Text = "So you also ate"
		wait()
		LT.Text = "So you also ate t"
		wait()
		LT.Text = "So you also ate th"
		wait()
		LT.Text = "So you also ate the"
		wait()
		LT.Text = "So you also ate the b"
		wait()
		LT.Text = "So you also ate the ba"
		wait()
		LT.Text = "So you also ate the bag"
		wait()
		LT.Text = "So you also ate the bagu"
		wait()
		LT.Text = "So you also ate the bague"
		wait()
		LT.Text = "So you also ate the baguet"
		wait()
		LT.Text = "So you also ate the baguett"
		wait()
		LT.Text = "So you also ate the baguette"
		wait()
		LT.Text = "So you also ate the baguette?"
		wait(2)
		LT.TextTransparency = 0
			
	end
end)

BaguetteEaten.Value is only checked once when the character is added. You should check it whenever the value’s Changed event is fired.

1 Like

So you want to check if it is above one? But your if statement checks if its equal to one.

if plr:WaitForChild("BaguetteEaten").Value >= 1 then

And like what @azqjanna said,

small thing you should add to your script

There is a better way to do this. (You should also use task.wait())

local Goal = 'So you ate the baguette?'

for i = 1, #Goal do
    LT.Text = Goal:sub(1,i) -- Only get characters from 1 to i
    task.wait()
end
2 Likes

Thanks for the tip

(30lettershasd)

Don’t do all those text updates. Instead use the property called “MaxVisibleGraphemes” in TextLabel.
When set to -1, it will always show the full text. If you set it to 0, nothing will show, set it to anything above 0 and it will show the amount of letters defined in the number.

local TextLabel = .. -- Define on your own
TextLabel.MaxVisibleGraphemes = -1 -- This resets it
local TextLabel.Text = "Hi this is the new text I want shown!"
for Index = -1,#TextLabel.Text do
	TextLabel.MaxVisibleGraphemes = Index
	task.wait()
end
2 Likes

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