Intermission Error 'ServerScriptService.Script:36: attempt to index number with 'Value' ' Always is seen after start time reaches 0

I want to make an Intermission

Annoying Error

I tried to do <, <=, (time.Value <= 0), still doesn’t work

-- // The main script

wait()
local started = false
local time = game.ReplicatedStorage:WaitForChild("st")

local tic = false
local tac = false
local endtime = game.ReplicatedStorage:WaitForChild("en")


spawn(function()
game:GetService("RunService").Stepped:Connect(function()
	if started then
		time = 5
		coroutine.wrap(function()
			if tic then return end
			tic = true
			endtime.Value = endtime.Value - 1
			wait(1)
			tic = false
		end)()
	else
		endtime.Value =  15
		coroutine.wrap(function()
			if tac then return end
			tac = true
			time.Value = time.Value -  1
	
			wait(1)
					tac = false
		end)()
	end
	if (endtime.Value <= 0) then
		started = false
		time.Value = 30
	end
	if (time.Value <= 0) then
		started = true
		endtime.Value = 15
	end
end)

end)
1 Like

Isn’t it this the problem?
Instead of time.Value = 5

1 Like

Time is a global variable. You can’t use it like that. Make sure you name your variable something else. Also, just like @N1njaNooby2 said, you set it to 5 when the loop starts.

oh yeah, miss-spell lol thanks

this happend to me before, when it wasn’t global var but normal var

By global variable, I meant syntax. You should avoid naming things after classes, and time seems to be one of those special classes. If it lights up blue, then you should change the name of it.