I have a normal script that uses the do function that activates an event, but I want it to wait 10 seconds before starting, but since I already have a wait() command for when the event ends, when I add a wait(10) to the beginning the script fails after second wait command but I get no warning from it.
Here is the full script.
do
local Timer = game.ReplicatedStorage.Timer
local inMatch = game.ReplicatedStorage.inMatch
local Event = game.ReplicatedStorage.Event
Event.Value = ""..script.Name
Timer.Value = 10
inMatch.Value = true
script.Parent.Parent.Parent.Transparency = 1
script.Parent.Parent.Parent.Parent.FakeButton.Transparency = 0
wait(10) --Here is when the script fails but it displays no warning
game.Lighting.Models.Coconut:Clone().Parent = workspace
wait(20) --Here is the other wait command
script.Parent.Parent.Parent.Transparency = 0
script.Parent.Parent.Parent.Parent.FakeButton.Transparency = 1
Event.Value = "None"
inMatch.Value = false
workspace.Coconut:Destroy()
debounce = false
print("Event Done!")
end
I’ve tried using countdown loops, pairs, but nothing seems to work for me, would there be any way to delay the script by 10 seconds without the script failing?
Plus this script is activated by its parent, using:
nextPick.Disabled = false
If that at all effects the script too.
I’ve also looked at other posts for help but no luck, so if there is one for it too let me know.
Try to test on where the exact location it doesn’t work by adding print statements after every line (or every significant line). I can’t see anything that would make wait(10) not work. It could be that another script/some part of your code is messing with the script.