Localscript completely stops when it reaches wait() or task.wait()

Hello, I encountered a problem where a local script would just stop at the first wait() or task.wait() and gives no errors; it just stops…

This only happens when the player where the scripts from was down, like needing help, and after the player was revived or saved after exiting the level. This didn’t happen to the other player.

I’ve tried rewriting the script in another script, and I’ve tried changing the wait to task.wait or vice versa, but this didn’t do anything.

BTW, it’s at line 49.

Is there anything I can do to fix this issue?

local TweenService = game:GetService("TweenService")
local Tweeninfo = TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut, 0, false, 0)
local Tweeninfo1 = TweenInfo.new(0.25, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut, 0, false, 0)
local Trans1 = {}
Trans1.BackgroundTransparency = 1
local Trans2 = {}
Trans2.TextTransparency = 1
local Sound1 = {}
Sound1.Volume = 1
local Vis1 = {}
Vis1.TextTransparency = 0
local Lighting = game:GetService("Lighting")
local Reverb = require(workspace.ReverbTypes)
local Sound2 = game.SoundService
game.ReplicatedStorage.GuiLVchange.OnClientEvent:Connect(function(Name, revN)
	local Descent = script.Parent.Descent.MainFrame
	local LVnames = Descent.Stuff.LVNAMES:GetChildren()
	local TweenFrame = TweenService:Create(script.Parent.Descent.Death, Tweeninfo, Trans1)
	local TweenSound = TweenService:Create(game.SoundService.SoundVolume, Tweeninfo, Sound1)
	local TweenTop = TweenService:Create(Descent.Stuff.TopCover, Tweeninfo1, Trans1)
	local TweenBottom = TweenService:Create(Descent.Stuff.BottomCover, Tweeninfo1, Trans1)
	local Ltable = require(game.ReplicatedStorage.LightTable)
	Lighting.ColorCorrection.TintColor = Ltable[1]
	Lighting.Atmosphere.Density = Ltable[2]
	Lighting.ColorCorrection.Brightness = Ltable[3]
	Lighting.ColorCorrection.Contrast = Ltable[4]
	Lighting.ColorCorrection.Saturation = Ltable[5]
	workspace.Camera.FieldOfView = Ltable[6]
	Lighting.Blur.Size = Ltable[7]
	Lighting.Brightness = Ltable[8]					
	script.Parent.Descent.Misc["ScreamForHelp?"].Position = UDim2.new(5, 0, 0.399, 0)
	script.Parent.Descent.Misc["ScreamForHelp?"].Interactable = false
	local Level = workspace.CurrentLevel:FindFirstChildWhichIsA("Folder")
	local Audio = Level["LV Audio"]
	Sound2.AmbientReverb = Reverb[revN]
	game.SoundService.SoundVolume.Volume = 0
	Descent.Stuff.BottomCover.BackgroundTransparency = 0
	Descent.Stuff.TopCover.BackgroundTransparency = 0
	workspace.OnDeath2:Stop()
	for _, label in ipairs(LVnames) do
		if label.Position == UDim2.new(0, 0, 0, 0) then
			label.Position = UDim2.new(0, 0, 1, 0)
			label.Text = Name
		end
		local T = TweenService:Create(label, Tweeninfo1, Vis1)	
		T:Play()
	end
	print("Work pls1")
	task.wait(1.75)--       Here When the script reaches the first wait based thing!
	print("Work pls2")
	for _, label in ipairs(LVnames) do
		local Pos = label.Position - UDim2.new(0, 0, 0.1, 0)
		local Tween = label:TweenPosition(Pos, Enum.EasingDirection.Out, Enum.EasingStyle.Bounce, 1)
		Tween = true
	end
	task.wait(0.25)
	workspace.SubName:Play()
	task.wait(2)
	for _, name in ipairs(LVnames) do
		local Tinvis = TweenService:Create(name, Tweeninfo1, Trans2)
		Tinvis:Play()
	end
	task.wait(0.25)
	TweenTop:Play()
	TweenBottom:Play()
	task.wait(0.25)
	TweenFrame:Play()
	TweenSound:Play()
end)

Also, before anyone asks, yes, I don’t have Windows activated. Yes, my PC/laptop stinks, and yes, this is a fangame of another game.

Where is the script located, because I have had an error like this, and it ended up being that when the character dies, the starter character scripts “stop working”

Maybe try putting it in starter player scripts?

2 Likes

Its Located in starterGUI i havent tried putting it in starter player scripts il try that

It works perfectly now!
Thanks!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.