Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Why isn't my script kicking other players?

Asked by 4 years ago

So, Im FURIOUS right now. I constantly run into problems with scripting, But this one i cant fix within even 5 FULL HOURS!!!! I made a kick system for my myth game, here But its not kicking players! How does this work you ask?

There is a list called "Aproved Players" and a variable called Owner. The variable is set to a string value withing the script. I did do:

owner = script.Owner.Value
aproved_players = {
owner
}

So it will let me in the game. BUT when i change owner to another name, It still lets me in! Basicly, I used this If thingy to check if a player is in the list:

game.Players.PlayerAdded:connect(function(plr)
if plr.MembershipType == Enum.MembershipType.Premium or (string.find(plr.Name,aproved_players[1])) ~= nil then
--Do something
end)

I've been wanting more features in my game lately, And i WANTED like i loved this one. Here's the snippet:

val = script.OnJoinKick.Wait.Value
val1 = val
owner = script.Owner.Value
print(owner)
aproved_players = {"Equinsox","hasanchik"}
banned_players = {"KonekoKittenWasTaken"}
owneringame = false 
gameclosed = script.GameClosed.Value
print(val1)
game.Players.PlayerAdded:connect(function(plr)
local function KickWay()
    print("Identified As UNKNOWN")
    if (string.find(plr.Name, banned_players[1])) == nil then
    if gameclosed == false then
    if plr.Character ~= nil then plr.Character:Destroy() end
    gui = script.OnJoinKick:Clone()
    gui.Parent = plr.PlayerGui
    wait(5)
    gui.Frame.Brighten.Disabled = false
    wait(val1)
    if owneringame == true then
    plr:Kick(plr.Name.." Is a follower of "..owner..".")
    elseif owneringame == false then
    plr:Kick(plr.Name.." Is not aproved.")
    end
    else
    plr:Kick("You do not have permission to join this game. (Game closed.)")
    end
    else
    plr:Kick("Banned.") 
    end
end
if not plr then return end
if plr.name == owner then owneringame = true end
print("Player Joined")
if plr.MembershipType == Enum.MembershipType.Premium or (string.find(plr.Name, aproved_players[1])) ~= nil then
print("Identified As "..plr.name)
else
KickWay()
end
end)
game.Players.PlayerRemoving:connect(function(plr)
if plr.Name == owner then
    owneringame = false
    end
end)
game:GetService('Players').PlayerAdded:connect(function(plr)
    plr.CharacterAdded:connect(function(character)
        character:WaitForChild("Humanoid").Died:connect(function()
           plr:Kick(" ")    
           gui2 = script.BlackOut:Clone()
           gui2.Parent = plr.PlayerGui
        end)
    end)
end)
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
hif = script.HideInterface:Clone()
hif.Parent = game.StarterPlayer.StarterPlayerScripts
hif.Disabled = false
game.Players.PlayerAdded:connect(function(plr)
local mouse = script.Mouse:Clone()
mouse.Parent = plr.PlayerGui
mouse.Disabled = false
local fp = script.FirstPerson:Clone()
fp.Parent = plr.PlayerGui
fp.Disabled = false
local sbifp = script.ShowBodyInFirstPerson:Clone()
sbifp.Parent = plr.PlayerGui
sbifp.Disabled = false
local dc = script.DeviceController:Clone()
dc.Parent = plr.PlayerGui
dc.Disabled = false
end)
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
game.Players.PlayerAdded:connect(function(plr)
wait(4)
hum = plr.Character:FindFirstChild("Humanoid")
hum.WalkSpeed = 9
end)
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

1 answer

Log in to vote
1
Answered by
karlo_tr10 1233 Moderation Voter
4 years ago

I have already made a whitelist system for one guy that supports names and ids, here it is:

local Whitelist = {Id = 111111111,Name = "Player",Name = "Player2"}

local function kick(Player)
    Player:Kick("Not whitelisted")
end

game.Players.PlayerAdded:Connect(function(Player)
    for i,v in pairs(Whitelist) do
        if i == "Id" then
            if Player.UserId == v then
                kick(Player)
            end
        elseif i == "Name" then
            if Player.Name == v then
                kick(Player)
            end
        end
    end
end)


If you have any questions or this doesn't solve your problem ask me!

0
I dont ant to use for i,v in pairs As it takes up space. hasanchik 49 — 4y
0
AND i dont have any use for id's hasanchik 49 — 4y
0
And, Sorry, But i am TOO lazy to modify your script to match mine. hasanchik 49 — 4y
0
AAAAAND i dont know how the script get a part of a string, Like how it's knowing if its "Name" or "Id" hasanchik 49 — 4y
View all comments (7 more)
0
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAND, i wanted to avoid for i,v in pairs. hasanchik 49 — 4y
0
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAND, i MOFIFIED IT AND IT IS STILL NOT WORKING! hasanchik 49 — 4y
0
Here's the link:https://pastebin.com/raw/1JY6QVet hasanchik 49 — 4y
0
I give you a tip. Please dont just post the answer, Or somebody with the same problem that you made the script for. They still may have some difficulties in the future if you dont explain it. And please make the answer modified to make it math with the asker's script They may also have trouble modifying the script to the new method, And please dont give out fast written answers (For reputation poi hasanchik 49 — 4y
0
You said you'd anser any questions? hasanchik 49 — 4y
0
Keep in mind that I clarified that I made simular one so I posted it here. I am busy and can't asnwer questions 24/7 .I will modify and update the code as soon as I find time for it! karlo_tr10 1233 — 4y
0
Also keep in mind that we are volunteers so you shouldn't rush us with our answers or spam the comments, thanks. karlo_tr10 1233 — 4y
Ad

Answer this question