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

script not working?

I was making this admin script but it didnt work, It didnt get errors either...

Admins = {"Player"}
Banned = {"Noob"}
Prefix = ":"

game.Players.ChildAdded:connect(function(player)
for i,v in pairs(Banned) do
if v.Name == Banned then
v:Kick()
end;
end;
end);

for a,x in pairs(Admins) do
if x.Name == Admins then
	function chat(msg)
	if msg == (Prefix.."ff me") then
	Instance.new("ForceField", game.Players.LocalPlayer.Character)
	end
	end
end
end

1 answer

✓ Accepted answer

The main problems with this script are the misuse of the variables you have. For example, line 7 should be

if v == player.Name then

instead, since Banned is a table, and v.Name wouldn't even work because the string "Noob" in your Banned table does not have the property or child 'Name.'

Also, change v:Kick() to player:Kick() since when you kick v, you're actually attempting to kick a string from your game.

To make sure all admins in your game get power, you must integrate the

for a,x in pairs(Admins) do

from line 13 to line 21 into the code under your ChildAdded listening event. Then you must change line 14 to

if x == player.Name then

for the same reason explained previously. THEN, change line 15 to

player.Chatted:connect(function(msg)

and add a parenthesis to the end of that function. Keep in mind these numbers all correspond to the current code, so when you maneuver that piece of code, the numbers apply strictly to this original code.

I noticed this was a local script a little late; I would just like to point out that for security purposes it generally isn't recommended to let the client wield that much server power through their own scripts, since third party exploits can manipulate available content in your game.

1 comment

1

You got down-voted for helping, wow. Up-voted.

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