Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Wait() interrupting my scripts and not making them continue?

I noticed that whenever I add a wait() function to the scripts I am making, they stop once the wait function arrives, even though the times is a very little interval of time... could anyone help me?

Examples:

local original = script.Parent.Parent
local up = script.Parent.Parent.Parent.Arrival

script.Parent.PromptButtonHoldEnded:Connect(function(plr)
	if plr.Team ~= game.Teams.CD then
		local goalData = {CFrame = up.CFrame}

		local tween = game.TweenService:Create(script.Parent.Parent,TweenInfo.new(4),goalData)
		tween:Play()
		
		wait(4) --Stops right here!!
		
		goalData = {CFrame = original.CFrame}
		local tween = game.TweenService:Create(script.Parent.Parent,TweenInfo.new(4),goalData)
		tween:Play()
	end
end)
script.Parent.MouseButton1Down:Connect(function()
	local player = game.Players.LocalPlayer
	local bname = "CD"

	player.Character.Humanoid.Health = 0
	
	if player.Team == game.Teams.Choosing then
		game.ReplicatedStorage.RemoteEvents.Teams:FireServer(bname)
	end

	script.Click:Play()

        wait(5)
	
	local CurrentCamera = workspace.CurrentCamera
	CurrentCamera.CameraType = Enum.CameraType.Custom
	CurrentCamera.CameraSubject = game.Players.LocalPlayer
	
	script.Parent.Parent.Parent.Enabled = false
	game.Workspace.Musics.Menu:Stop()
	game.Workspace.Musics.Background:Play()
end)

1 answer

Why do you want the script to wait? Try add print("ok") directly after the wait and leave it for 10 seconds to run and see if it comes up? If the thing prints the issue is probably on your tween declaration (is it supposed to be "new(4)" or "new[4]" ? If it doesn't print then try removing the wait and seeing if it prints?

1 comment

0

Didn't save my formatting sorry

This discussion is preserved as it was. New answers, comments, and votes are closed.