Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do i kick a player who is not a tester?

I am trying to make it that if a players name is not part of the tester list then they are kicked from the game

local DataStore = game:GetService("DataStoreService")
local TesterList = DataStore:GetDataStore("TesterList")
local Testers = {"TheRebusa", "ItzOnlyCrisis", "Mazio44", "jakeybob334", "Michael1351", "R3fuse", "i_superstar"}

game.Players.PlayerAdded:connect(function(Player)
	local TestCheck = Instance.new("BoolValue", Player)
	TestCheck.Name = "IsTesting"
	
	for i, TesterName in ipairs(Testers) do
	    if Player.Name == TesterName then
		TestCheck.Value = true
	end
end
	
	if TestCheck.Value == false then
		Player:Kick("You're not a tester") 
	end

end)

1 answer

Well, I don't exactly understand why you're trying to use DataStore and BoolValues for player names. But I re-wrote the script using the same Variable 'Testers'.

local Testers = {"TheRebusa", "ItzOnlyCrisis", "Mazio44", "jakeybob334", "Michael1351", "R3fuse", "i_superstar"} -- just names of people
	game.Players.PlayerAdded:connect(function(plr) -- grabs players who just joined the game
	for _,v in pairs(Testers) do  -- looks through the list Testers, makes the new variable "v"
		if plr.Name ~= v then  -- checks to see if the players name isn't in the list of strings from v
		plr:Kick('You are not a tester') -- kicks the player

		end
	end
end)

3 comments

1

That would kick the player after looking at the first value. You want to also see if the _ is at the last value, then kick..

0

I have used the same method for a few of my War Clans, it always worked for me, but then again I did stop doing everything roblox for a while.

0

It does not work

This discussion is preserved as it was. New answers, comments, and votes are closed.