Not giving me tool

Hello Dev’s, So today I was adding commands to the adonis admin plugin feature that lets you add custom commands. For some reason why I type, It gives me a error in the admin.



Please Help.

you cant get the local player on the server, and if this is on the client it is a pretty unsecure admin system

1 Like

I keep forgetting that. Its a common mistake I do

I also made another code/ a server version of the script that’s not in the admin. It works perfectly fine But I’m trying to make it so only certian teams can use it. How can I do that?

Send the code in text format not image format and I would be happy to help you out.

local Tool = RepStorage["RandomOBJ's"]:WaitForChild('Football')

game.Players.PlayerAdded:Connect(function(Player)
	Player.Chatted:Connect(function(Text)
		if Text:lower() == ":ball" then
			print("Detected command")
			Tool:Clone().Parent = Player.Backpack
			end
	end)
end)

Try this code. Set the team name and that should work.

local RepStorage = game:GetService("ReplicatedStorage")

local wantedTeam = game.Teams:WaitForChild("TeamNameHere") -- CHANGE TEAM NAME

local Tool = RepStorage["RandomOBJ's"]:WaitForChild('Football')

game.Players.PlayerAdded:Connect(function(Player)
	Player.Chatted:Connect(function(Text)
		if Text:lower() == ":ball"  and Player.Team == wantedTeam then	
			print("Detected command")
			Tool:Clone().Parent = Player.Backpack
		end
	end)
end)

And do I reright the same thing you added for multiple teams?

That script is for one team only. Here I made a new script that uses a table instead to put all the teams into.

local RepStorage = game:GetService("ReplicatedStorage")

local wantedTeams = {} -- Put the teams in this table. Make sure the teams are not strings but actual team instances.

local Tool = RepStorage["RandomOBJ's"]:WaitForChild('Football')

game.Players.PlayerAdded:Connect(function(Player)
	Player.Chatted:Connect(function(Text)
		if Text:lower() == ":ball"  and table.find(wantedTeams, Player.Team) then	
			print("Detected command")
			Tool:Clone().Parent = Player.Backpack
		end
	end)
end)

SHOOT I meant how would I do it for only certians teams cannot use it that’s my bad

Simple fix. Just putted not infront of the table.find so that it will only work if the player is NOT in that team.

local RepStorage = game:GetService("ReplicatedStorage")

local wantedTeams = {} -- Put the teams in this table. Make sure the teams are not strings but actual team instances.

local Tool = RepStorage["RandomOBJ's"]:WaitForChild('Football')

game.Players.PlayerAdded:Connect(function(Player)
	Player.Chatted:Connect(function(Text)
		if Text:lower() == ":ball"  and not table.find(wantedTeams, Player.Team) then	
			print("Detected command")
			Tool:Clone().Parent = Player.Backpack
		end
	end)
end)
1 Like

If that script worked than mark the post as the solution so that other users know its already solved and so that if they need help than the answer is for them aswell.

What errors? Is it fixed now? If not then tell me whats wrong and I can fix it.

It worked I just did the teams wrong