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

If function is triggered more than once, after 20s of the first function they all disappear?

Asked by
Ben_B 9
4 years ago

Is there anyway to clone the gui to make it so it doesnt disappear? Here is the script:

local statusDom = game.ReplicatedStorage.StatusDom
local text = script.Parent.TextLabel
servermusic = game.Workspace.Sounds.new_summer
ding = game.Workspace.Sounds.Celebration

statusDom.Changed:Connect(function()
script.Parent.Enabled = true
text.Text = statusDom.Value
wait(20)
script.Parent.Enabled = false
end)

Basically I would like to add a tween to the gui in future so they dont overlap, but say if the function istriggered three times, the second and third one 10 seconds after the original one. When the original UI has been on screen for 20 seconds they all disappear. Help?

1 answer

Log in to vote
0
Answered by
Ben_B 9
4 years ago
Edited 4 years ago

Ive tried this too and it hasnt worked:

local statusDom = game.ReplicatedStorage.StatusDom
local text = script.Parent.TextLabel
servermusic = game.Workspace.Sounds.new_summer
ding = game.Workspace.Sounds.Celebration

statusDom.Changed:Connect(function()
local clone = script.Parent:Clone()
clone.Parent = game.StarterGui
clone.Enabled = true
clone.TextLabel.Text = statusDom.Value
wait(20)
clone.Enabled = false
end)
Ad

Answer this question