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

Why cant I kick non testers?

Asked by 4 years ago
Edited 4 years ago

Hi, I'm currently making a game in very early alpha as of right now with 3 of my friends. I want to make a script to kick everyone who isn't them, and I have, but however it doesn't work even though when you run it in the game client you get no errors, nothing. Here is the script:

local plr = game.Players.LocalPlayer

if plr.Name == not "darkstar2121a" or not "zebrafishink123" or not "aidenlygamer" or not "myherodekusuper" then
    plr:Kick("You have been kicked. Reason: You are not a tester")
end

And yes I know that this can be done more efficiently with tables and user ID's, but honestly it doesn't really matter since the game is almost out of alpha stages anyway.

Help would be greatly appreciated.

EDIT: I forgot to mention that this is in a local script in replicated first if that helps.

1 answer

Log in to vote
0
Answered by 4 years ago

I do not know myself why, but for some reason ROBLOX has an issue with more than one player permission, what I suggest, is that you have a ServerScript that is something like:

game.Players.PlayerAdded:Connect(function(Player)
    local TesterValue = Instance.new("BoolValue", Player)
    TesterValue.Name = "IsTester"

    wait(2) --Let the client do its work
    if TesterValue.Value == false then
    Player:Kick("Not a tester")
    end
end)

The client script should be like:

local Player = game.Player.LocalPlayer
local Value = Player:WaitForChild("IsTester")

if Player.Name == "FirstName" then
    Value.Value = true
elseif Player.Name == "SecondName" then
    Value.Value = true
end

You can keep adding elseif to the code, remember though, there is only one end.

Let me know if this helped!

0
It did thanks! darkstar2121a 13 — 4y
0
There is probably an better way, but this is just a pretty simple quick thing I put together, since this game will launch soon. JailBreaker_13 350 — 4y
Ad

Answer this question