I need the ExtendTime function to run after the CheckVerification function, but I’m not sure how to do this without breaking everything in the script. I’ve tried 3 different way’s that I know and none of them worked.
local REMOTE_FUNCTION1 = game:GetService("ReplicatedStorage"):WaitForChild("rf1")
local LAST_VERIFICATION = 0
local function ExtendTime(player)
while wait(1) do
LAST_VERIFICATION = LAST_VERIFICATION + 1
if LAST_VERIFICATION == 10 then
player:Kick()
end
end
end
local function checkVerification(player, verification)
LAST_VERIFICATION = 0
if verification[1] == math.floor(workspace.DistributedGameTime) then
return "verified"
else
return "failed"
end
end
REMOTE_FUNCTION1.OnServerInvoke = checkVerification
I’m not too sure what it is you’re trying to achieve other than having the ExtendTime() function run, or where. But what you can do is have the while loop in your ExtendTime() function not yield by wrapping it inside task.spawn(), note that i’ll also replace some other parts such as wait() to task.wait() and x = x + 1 to x += 1.
local REMOTE_FUNCTION1 = game:GetService("ReplicatedStorage"):WaitForChild("rf1")
local LAST_VERIFICATION = 0
local function ExtendTime(player)
task.spawn(function()
while task.wait(1) do
LAST_VERIFICATION += 1
if LAST_VERIFICATION == 10 then
player:Kick()
break
end
end
end)
end
local function checkVerification(player, verification)
LAST_VERIFICATION = 0
if verification[1] == math.floor(workspace.DistributedGameTime) then
ExtendTime(player)
return "verified"
else
return "failed"
end
end
REMOTE_FUNCTION1.OnServerInvoke = checkVerification