Here is the script for the server-sided temp ban: I've tried in Roblox studio and in the actual game, but it doesn't work. In the output, it says "Ban has been lifted!". Thanks for taking interest in this.
game.ReplicatedStorage.ModEvents.BanPlayer.OnServerEvent:Connect(function(player, Username, Reason, SelectedDays, DayValue)
local unbantime = os.time() + SelectedDays
if unbantime >= os.time() then
print("Ban has been lifted!")
else
game.Players:FindFirstChild(Username):Kick("You have been banned for: "..DayValue.." day(s).".."\n Reason:"..Reason.. "You were banned by: "..player.Name.." | "..player.UserId)
end
end)
Here is the local script that runs the GUI:
local DefaultOptionColour = Color3.fromRGB(157, 157, 157)
local SelectedOptionColour = Color3.fromRGB(255, 76 ,76)
local Days = script.Parent.Parent.Days
local SelectedDays = nil
local DayValue = nil
for _, day in pairs(Days:GetChildren()) do
day.MouseButton1Click:Connect(function()
SelectedDays = day:WaitForChild("timevalue").Value
local DayValue = day:WaitForChild("dayvalue").Value
day.ImageColor3 = SelectedOptionColour
for _, day2 in pairs(Days:GetChildren()) do
if day2 ~= day then
day2.ImageColor3 = DefaultOptionColour
end
end
end)
end
script.Parent.MouseButton1Click:Connect(function()
local Username = script.Parent.Parent.Username.TextBox.Text
local Reason = script.Parent.Parent.Reason.TextBox.Text
local Evidence = script.Parent.Parent.Evidence.TextBox.Text
print("Button was pressed!")
if game.Players:FindFirstChild(Username) then
print("Succesfully got a player!")
game.ReplicatedStorage.ModEvents.BanPlayer:FireServer(Username, Reason, SelectedDays, DayValue)
else
print("Player does not exist!")
end
end)
Could someone please help me? I don't know if I should use data stores or another time value tick or os.date. Thank you Scripting Helpers community!
