Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Script not changing text in text label When screen gui is enabled?

I am trying to make it so when you press a button it enables the GUI and it sets off this script which that script works fine. I have been working on this for an hour and the wikis are no help

My script(Local Script)

wait()

if game.StarterGui.ScreenGui.Enabled == true then
	wait(.2)
	script.Parent.Text = ("I")
	wait(.2)
	script.Parent.Text = ("I S")
	wait(.2)
	script.Parent.Text = ("I Sm")
	wait(.2)
	script.Parent.Text = ("I Sme")
	wait(.2)
	script.Parent.Text = ("I Smel")
	wait(.2)
	script.Parent.Text = ("I Smell")
	wait(.2)
	script.Parent.Text = ("I Smell L")
	wait(.2)
	script.Parent.Text = ("I Smell Li")
	wait(.2)
	script.Parent.Text = ("I Smell Lik")
	wait(.2)
	script.Parent.Text = ("I Smell Like")
	wait(.2)
	script.Parent.Text = ("I Smell Like C")
	wait(.2)
	script.Parent.Text = ("I Smell Like Ch")
	wait(.2)
	script.Parent.Text = ("I Smell Like Che")
	wait(.2)
	script.Parent.Text = ("I Smell Like Chee")
	wait(.2)
	script.Parent.Text = ("I Smell Like Chees")
	wait(.2)
	script.Parent.Text = ("I Smell Like Cheese")
	wait(.2)
	script.Parent.Text = ("I Smell Like Cheese.")

if game.StarterGui.ScreenGui.Enabled == false then
	repeat until game.StarterGui.ScreenGui.Enabled == true
	
end
end

wait()

Thank you in advance!

2 answers

✓ Accepted answer
local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer
local PlayerGui = LocalPlayer.PlayerGui

local Gui = PlayerGui.ScreenGui --[[ the gui you've disabled gui and the one that you want a script to run to make that text effect when it's enabled. ]]

local TextLabel = Gui.Frame.TextLabel -- textlabel to change
local EpicText = "I Smell Like Cheese." -- epic bro text

local Button = ... -- put your text button path here

spawn(function()
repeat wait() until Gui.Enabled == true  -- checking until enabled

TextLabel.Text = '' -- reset current text

for Ind = 1, #EpicText do -- typewriter effect
	TextLabel.Text = TextLabel.Text .. EpicText:sub(Ind, Ind) ; wait(.2)
   end
end)

Button.MouseButton1Click:Connect(function() -- when button pressed
  PlayerGui.ScreenGui.Enabled = true -- sets the gui you wanted to enabled
end)

If this has worked for you tell me, if it hasn't tell me why it has not. I've tested this and it's working.

wait()

if game.StarterGui.ScreenGui.Enabled == true then
    wait(.2)
    script.Parent.Text = ("I")
    wait(.2)
    script.Parent.Text = ("I S")
    wait(.2)
    script.Parent.Text = ("I Sm")
    wait(.2)
    script.Parent.Text = ("I Sme")
    wait(.2)
    script.Parent.Text = ("I Smel")
    wait(.2)
    script.Parent.Text = ("I Smell")
    wait(.2)
    script.Parent.Text = ("I Smell L")
    wait(.2)
    script.Parent.Text = ("I Smell Li")
    wait(.2)
    script.Parent.Text = ("I Smell Lik")
    wait(.2)
    script.Parent.Text = ("I Smell Like")
    wait(.2)
    script.Parent.Text = ("I Smell Like C")
    wait(.2)
    script.Parent.Text = ("I Smell Like Ch")
    wait(.2)
    script.Parent.Text = ("I Smell Like Che")
    wait(.2)
    script.Parent.Text = ("I Smell Like Chee")
    wait(.2)
    script.Parent.Text = ("I Smell Like Chees")
    wait(.2)
    script.Parent.Text = ("I Smell Like Cheese")
    wait(.2)
    script.Parent.Text = ("I Smell Like Cheese.")
else
if game.StarterGui.ScreenGui.Enabled == false then
    repeat until game.StarterGui.ScreenGui.Enabled == true

end
end

wait()

1 comment

0

It said game script timeout when I tried it

This discussion is preserved as it was. New answers, comments, and votes are closed.