So I put in a Touched event into a countdown event for my game, and when I run it, it glitches like crazy I need to know how to fix that, thanks
local Sound1 = game.Workspace.Sound1
local Sound2 = game.Workspace.Sound2
local Cave = game.Workspace.Cave
local frame = script.Parent.Frame
local Count = game.Workspace.Elevator.Timer.SurfaceGui.TextLabel
game.ReplicatedStorage.Teleport.OnClientEvent:Connect(function()
script.Parent.Frame.Visible = false
Sound1.Playing = false
Sound2.Playing = true
script.Parent.Frame.Visible = true
wait(3)
Cave.Playing = true
for i = 1,10 do
frame.BackgroundTransparency += 0.1
wait(0.01)
Sound2.Playing = false
script.Parent.TextLabel.Visible = true
wait(4)
Cave.Playing = false
end
end)
game.ReplicatedStorage.Elevatormusic.OnClientEvent:Connect(function()
game.Workspace.Elevator.Ebarrier.CanCollide = true
script.Parent.Frame.Visible = false
game.Workspace.Elevator.ElevatorMusic.ElevatorMusic.Playing = true
local TweenService = game:GetService("TweenService")
local Door = game.Workspace.Elevator.Door
local goal = {}
goal.Position = Vector3.new(227.527, -198.588, -18696.512)
goal.Size = Vector3.new(7.089, 9.105, 0.825)
local tweenInfo = TweenInfo.new(5)
local tween = TweenService:Create(Door, tweenInfo, goal)
wait(3)
tween:Play()
local seconds = 15
repeat
seconds = seconds -1
Count.Text = seconds
wait(1)
until seconds == 0
end)