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

Adding debounce to this?

Asked by
FiredDusk 1466 Moderation Voter
8 years ago

When I die, this pops up again.

Text1 = "Man, you are in a terrible situation!"
Text2 = "You need to try to escape this building."
Text3 = "There is no time to be playing around, get going..."

function Type(Text)
 local CurrentText = script.Parent.Text
 local Length = script.Parent.Text:len()
 for i = Length,0,-1 do
  wait()
  script.Parent.Text = CurrentText:sub(0,i)
 end
 wait(.5)
 local Length = Text:len()
 for i = 1,Length do
  wait()
  script.Parent.Text = Text:sub(1,i)
 end
end

wait(3)
Type(Text1)
wait(3)
Type(Text2)
wait(3)
Type(Text3)
wait(3)
Type("")
script.Parent.Parent.Visible = false
0
What do you mean? When you die the script runs again? YellowoTide 1992 — 8y
0
Yea FiredDusk 1466 — 8y

1 answer

Log in to vote
2
Answered by 8 years ago

What I would do for this is create a value in the player to check if he already's seen the message.

local sawMsg
if player:FindFirstChild("sawMsg") then
    sawMsg = player.sawMsg
else
    sawMsg = false
    Instance.new("BoolValue", player).Name = "sawMsg"
end

if not(sawMsg) then
    --The rest of your code in here
end

This will check if the player already has seen the message, if they have it won't show it again, otherwise it will show the message for the first time.

Ad

Answer this question