I’ve searched on DevForums for a while and came up with nothing good until I figured that I could just use a table of users that can fire remotes.
Small problem,
I’ve tested it on myself by making a check if the Player.Name is inside the ModuleScript Table filled with users.
If attempted to be fired, the player should be kicked and the remote should NOT get fired.
Here’s my script for checking… (LocalScript)
deleted code
No errors in output show up when the client-side check is being executed.
I’ve already tried Server-side checks with worked partly but of course the server cannot access LocalPlayer… so it couldn’t kick, although it still fired the remote.
local Whitelist = require(game.ReplicatedStorage:WaitForChild("Technica"):WaitForChild("Administrators"))
local Player = game.Players.LocalPlayer
API.OnClientEvent:Connect(function()
for Index, PlayerInList in pairs(Whitelist) do
if Player.Name ~= PlayerInList then
Player:Kick("Attempted to fire a remote.")
warn(Player.Name.." attempted to fire a remote while unwhitelisted.")
end
end
end)
You made a mistake in pairs, you named the player you received as “WhiteList” and the script could not identify the player you are checking on the name or table WhiteList, maybe I explained it wrong, but the new script does not seem to have an error (maybe)
local Whitelist = require(game.ReplicatedStorage:WaitForChild("Technica"):WaitForChild("Administrators"))
local Player = game.Players.LocalPlayer
API.OnClientEvent:Connect(function()
local PlayerFindedInList = false
for Index, PlayerInList in pairs(Whitelist) do
if Player.Name == PlayerInList then
PlayerFindedInList = true
end
end
if PlayerFindedInList then
-- If need
else
Player:Kick("Attempted to fire a remote.")
warn(Player.Name.." attempted to fire a remote while unwhitelisted.")
end
end)
--[[
This ModuleScript is for whitelisting administrators for your game, to use Technica.
You can add as many as you want, just put a , after each user.
To remove an admin, just remove their name or entire line.
]]--
local Administrators = {
"Luhkaaa",
"Millersons"
}
return Administrators
Try using this script as the one that kicks the users:
local Whitelist = require(game.ReplicatedStorage:WaitForChild("Technica"):WaitForChild("Administrators"))
API.OnClientEvent:Connect(function(Player)
if not table.find(WhiteList, Player.Name) then
Player:Kick("Attempted to fire a remote.")
warn(Player.Name.." attempted to fire a remote while unwhitelisted.")
end
end)
The reason your script kicked you regardless, is because if you didn’t have the name of both the whitelisted people, it would kick you. I provided a smaller script that kicks only if your name never appears in it
API.OnServerEvent:Connect(function(Player)
if not table.find(WhiteList, Player.Name) then
Player:Kick("Attempted to fire a remote.")
warn(Player.Name.." attempted to fire a remote while unwhitelisted.")
end
end)