Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Taking a few seconds to pop up?

Asked by
FiredDusk 1466 Moderation Voter
8 years ago

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

Log in to vote
1
Answered by 8 years ago

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.

Ad

Answer this question