I am making a admin system, and it has the ban button in it, what I am trying to do is have a notification system set up, and with a username box entry, and a remote event. When the remote event is fired, it checks in the module script WL, which is returns user ID’s, then, if a user id matches, it fires the remote. But the only problem is the if statement check (Line 6
)
I have tried many solutions including; print debugging, directory checks, statement checks.
No errors print in console.
Remote event script:
script.Parent.OnServerEvent:Connect(function(plr, target)
local WL = require(script.Parent.Parent.Parent.Parent.Parent:WaitForChild("WL"))
local whitelisted = WL.whitelisted
for i,v in ipairs(whitelisted) do
if plr.UserId == v then
for _, t in pairs(game.Players:GetPlayers()) do
if t.Name == target then
print("kicked")
t:Kick("\n\n == LYFE ADMIN SYSTEM == \n\n You have been kicked by " .. tostring(plr.Name))
script:WaitForChild("SendGlobal"):FireAllClients(target, plr.Name)
end
end
end
end
end)
Local script:
local notifDB = false
script.Parent.MouseButton1Click:Connect(function()
local username = script.Parent:WaitForChild("Username")
local plr = game.Players.LocalPlayer
local WL = require(script.Parent.Parent.Parent:WaitForChild("WL"))
local whitelisted = WL.whitelisted
for i,v in ipairs(whitelisted) do
if plr.UserId == v then
local denied = false
local callback
local Duration = 2
local success, result = pcall(function()
if username.Text == plr.Name then
callback = "X"
denied = true
return "You cannot kick yourself!"
else
denied = false
script.Kick:FireServer(username.Text)
end
end)
local showUI = coroutine.wrap(function()
local Update = Instance.new("TextLabel")
local UICorner = Instance.new("UICorner")
local UITextSizeConstraint = Instance.new("UITextSizeConstraint")
--Properties:
Update.Name = "Update"
if denied == false then
callback = "Y"
Update.Text = "Successfully kicked user"
Update.TextColor3 = Color3.fromRGB(255, 255, 0)
else
callback = "X"
Update.Text = "ERROR: (" .. tostring(result) .. ")"
Update.TextColor3 = Color3.fromRGB(255, 85, 0)
end
Update.Parent = script.Parent.Parent.Parent.Parent
Update.BackgroundColor3 = Color3.fromRGB(83, 83, 83)
Update.BackgroundTransparency = 0.150
Update.Position = UDim2.new(0.27477476, 0, 1, 0)
Update.Size = UDim2.new(0.45045045, 0, 0.0635400936, 0)
Update.Font = Enum.Font.Ubuntu
Update.TextScaled = true
Update.TextSize = 28.000
Update.TextWrapped = true
UICorner.Parent = Update
UITextSizeConstraint.Parent = Update
UITextSizeConstraint.MaxTextSize = 28
game:GetService("TweenService"):Create(Update, TweenInfo.new(.5), {Position = UDim2.new(0.275, 0,0.9, 0)}):Play()
task.wait(Duration)
local down = game:GetService("TweenService"):Create(Update, TweenInfo.new(.5), {Position = UDim2.new(0.27477476, 0, 1, 0)})
down:Play()
down.Completed:Wait()
down:Destroy()
Update:Destroy()
end)
showUI()
if notifDB == false then
local notify = coroutine.wrap(function()
notifDB = true
local noti = Instance.new("Sound")
if callback == "Y" then
noti.SoundId = "rbxassetid://6696469190"
elseif callback == "X" then
noti.SoundId = "rbxassetid://7383525713"
end
noti.Volume = 1
noti.Name = "Notification"
noti.Parent = script.Parent.Parent.Parent.Parent
noti:Play()
noti.Ended:Wait()
noti:Destroy()
notifDB = false
end)
notify()
end
username.Text = ""
end
end
end)