I was scripting a system today and for some reason the parameters were only picking up two I put in there and re using them. It is not picking up the duration parameter I put in. And they are in the correct order.
Server
function BanFunction.OnServerInvoke(Player, Reason, Duration)
print(Player)
print(Duration)
print(Reason)
local Success, Error = pcall(function()
BanStore:SetAsync(tostring(Player.UserId), {BanStart = os.time(), BanDuration = (Duration * secondsInADay), BanReason = Reason});
print("Bannedt")
end)
print(Duration)
Player:Kick(Duration);
if not Success then
warn("Not successful.")
end
end
Client
local function onBanButtonClicked()
if selectedPlayerId ~= nil then
local playerToKick = game.Players:GetPlayerByUserId(selectedPlayerId)
if playerToKick then
banRemote:InvokeServer(playerToKick, kickReason.Text, 1)
print("Banned " .. selectedPlayerId)
else
warn("Could not find player to kick.")
end
else
warn("No player selected")
end
end