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

script not working?

Asked by 8 years ago

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

Log in to vote
0
Answered by
Legojoker 345 Moderation Voter
8 years ago

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
You got down-voted for helping, wow. Up-voted. ISellCows 2 — 8y
Ad

Answer this question