I was trying to script a code that teleports players to a certain area when a timer finishes, and from nowhere, when I call the function minutes() its says: Attempt to call a number value.
Please help me.
local timerREM = game.ReplicatedStorage.Timer_RemoteEvent
local Totaltime = {00, 10} -- For changing the total time of the timer, change the 1st (minutes) and 2nd (seconds) value --
local minutesval = Totaltime[1]
local secondsval = Totaltime[2]
local totaltime = tostring(minutesval.. ": ".. secondsval)
local function minutes() -- Important Part
minutesval = minutesval - 1
totaltime = tostring(minutesval.. ": ".. secondsval)
timerREM:FireAllClients(totaltime)
end
local function seconds()
if minutesval == 0 and secondsval == 0 then
print("The players are spawning again")
local players = game.Players:GetChildren()
local PlayerCharacters = {}
local spawns = game.Workspace.Spawns
for i, player in pairs (players) do
table.insert(PlayerCharacters, #PlayerCharacters + 1, player.Character)
end
for i, v in pairs(PlayerCharacters) do
local desiredSpawn = math.random(1, 12)
v.HumanoidRootPart.Position = Vector3.new(spawns[desiredSpawn].Position + spawns[desiredSpawn].Size/2)
end
totaltime = tostring(Totaltime[1].. ": ".. Totaltime[2])
minutes = Totaltime[1]
seconds = Totaltime[2]
end
if secondsval == 0 then -- Here is the error --
secondsval = 60
minutes()
end
secondsval = secondsval - 1
totaltime = tostring(minutesval.. ": ".. secondsval)
timerREM:FireAllClients(totaltime)
end
while true do
local times = 0
while times < 60 do
times = times + 1
wait(1)
seconds()
end
end
The thing is that when I call the function seconds() the script doesnt says there's an error.
This ocurred to me much times, like when I was trying to tween a GUI's position, and when calling functions.

2 comments
Thanks it helped
Thanks it helped