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

Taking a few seconds to pop up?

This script makes a Gui pop up but it is taking about 2 seconds to pop up. I want the gui to pop up right when touched the part.


local stop = false

game.Workspace.GuiTextChanged.Touched:connect(function(PartTouched)
if not stop then
stop = true
local Text1 = "Oh gosh, that wall was not there before! Oh no!"
local Player = game.Players:GetPlayerFromCharacter(PartTouched.Parent)

    Player.PlayerGui.TalkingGui.Frame.TextLabel.Visible = true


    local function Type(Text)
 Player.PlayerGui.TalkingGui.Frame.Visible = true
local CurrentText = Player.PlayerGui.TalkingGui.Frame.TextLabel.Text
 local Length = Player.PlayerGui.TalkingGui.Frame.TextLabel.Text:len()
 for i = Length,0,-1 do
  wait()
  Player.PlayerGui.TalkingGui.Frame.TextLabel.Text = CurrentText:sub(0,i)
 end
 wait(.5)
 local Length = Text:len()
 for i = 1,Length do
  wait()
  Player.PlayerGui.TalkingGui.Frame.TextLabel.Text = Text:sub(1,i)
 end
end

wait(2)
Type(Text1)
wait(2)
Type("")

Player.PlayerGui.TalkingGui.Frame.Visible = false
wait(5) -- how long you want it to be
stop = false

end
end)

1 answer

✓ Accepted answer

On line 28, you have a wait(2) before calling your function Type(). Remove that to have it pop up immediately after touching the part.

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