After 19 minutes, I want the player to rejoin after 19 minutes, but I’m having a tough time detecting when the player has no input for 19 minutes, it fires a remote. There’s a value always true in my table, stopping it from continuing. Heres the code:
local timer = 0;
local maxTime = 5;
local UIS = game:GetService("UserInputService")
local remote = game.ReplicatedStorage.Events["Auto Rejoin"];
local Enums = {};
UIS.InputBegan:Connect(function(input, GP)
if input then
Enums[input] = true;
print(typeof(input))
timer = 0
else
warn("No input detected from UIS.InputBegan")
end
end)
UIS.InputEnded:Connect(function(input, GP)
if input then
Enums[input] = false;
print("INPUT ENDED")
else
warn("No input detected from UIS.InputEnded")
end
end)
local function checkEnums()
print(Enums)
for enumType, boolean in pairs(Enums) do
if boolean ~= false then
timer = 0
return false;
end
end
return false;
end
while task.wait(1) do
checkEnums();
if timer >= maxTime then
remote:FireServer();
timer = 0;
print("Player needs rejoining!")
else
timer += 1;
end
end