Script won´t work!

so, my script isnt working no errors and it won´t also loop. script:

local inround = game.ReplicatedStorage.Values:WaitForChild("inround")


local tp1 = game.Workspace:FindFirstChild("TP1")
local tp2 = game.Workspace:FindFirstChild("TP2")
local tp3 = game.Workspace:FindFirstChild("TP3")
local tp4 = game.Workspace:FindFirstChild("TP4")

local players = game.Players:GetPlayers()

inround = false

game.ReplicatedStorage.Remotes.r1.OnServerEvent:Connect(function(player)
	local tl = player.PlayerGui.countdowngui.TextLabel
	if #players > 0 then
		while true do
			for i = 10, 0, -1 do
				tl.Text = "Starting in:  "..i.." secs"
				inround = false
				task.wait(1)
			end
			player.Character.HumanoidRootPart.Position = tp1.Position or tp2.Position or tp3.Position or tp4.Position
			wait(1)
			local sword = game.ReplicatedStorage:FindFirstChild("ClassicSword")
			local newsword =  sword:Clone()
			while true do
				for i = 20, 0, -1 do
					tl.Text = "Ending in "..i.." secs"
					inround = true
					task.wait(1)
					newsword.Parent = player.Backpack
				end
			end
		end
		
		
		
	end
	



	end)


		

gui script local script;

local player = game.Players.LocalPlayer

game.ReplicatedStorage.Remotes.r1:FireServer(player)

this script probably runs before any players join the game. Check the number of players directly instead of through a variable.

local inround = game.ReplicatedStorage.Values:WaitForChild("inround")


local tp1 = game.Workspace:FindFirstChild("TP1")
local tp2 = game.Workspace:FindFirstChild("TP2")
local tp3 = game.Workspace:FindFirstChild("TP3")
local tp4 = game.Workspace:FindFirstChild("TP4")

inround = false

game.ReplicatedStorage.Remotes.r1.OnServerEvent:Connect(function(player)
	local tl = player.PlayerGui.countdowngui.TextLabel
	if #game.Players:GetPlayers() > 0 then
		while true do
			for i = 10, 0, -1 do
				tl.Text = "Starting in:  "..i.." secs"
				inround = false
				task.wait(1)
			end
			player.Character.HumanoidRootPart.Position = tp1.Position or tp2.Position or tp3.Position or tp4.Position
			wait(1)
			local sword = game.ReplicatedStorage:FindFirstChild("ClassicSword")
			local newsword =  sword:Clone()
			while true do
				for i = 20, 0, -1 do
					tl.Text = "Ending in "..i.." secs"
					inround = true
					task.wait(1)
					newsword.Parent = player.Backpack
				end
			end
		end
	end
end)
1 Like

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