|
| 17 Sep 2015 09:49 PM |
Okay so I'm trying to make a ban script with data stores. Whenever i test online it says Line 29, argument one missing or nil
local event = game.ReplicatedStorage:WaitForChild("RemoteEvent") local datastoreservice = game:GetService("DataStoreService") local banliststore = datastoreservice:GetDataStore("MLP3DRPBanlist")
game.Players.PlayerAdded:connect(function(player) if player:IsInGroup(2656742) then local rank = player:GetRankInGroup(2656742) if rank == 255 or rank == 2 then local modgui = player:WaitForChild("PlayerGui"):WaitForChild("Mod") modgui:WaitForChild("Framebutton").Visible = true end end local playerid = "user-"..player.userId local check = banliststore:GetAsync(playerid) if check then player:Kick() end end)
event.OnServerEvent:connect(function(...) local tuple = {...} local playername = tostring(tuple[2]) local banplayer = game.Players:FindFirstChild(playername) if banplayer then local playerid = "user-"..banplayer.userId banliststore:SetAsync(playerid) -- argument two missing or nil banplayer:Kick() end end) |
|
|
| Report Abuse |
|
|
|
| 17 Sep 2015 09:49 PM |
| *** I meant Argument 2 missing or nil! |
|
|
| Report Abuse |
|
|
|
| 17 Sep 2015 09:52 PM |
First of all, it trusts the client to send a player to ban without verifying if that player has the authority to ban, which means a hacker could abuse this ban any player they wish.
Second, SetAsync takes an argument of a key and a value, so set the value to true.
banliststore:SetAsync(playerid, true) |
|
|
| Report Abuse |
|
|
|
| 17 Sep 2015 09:55 PM |
| Thanks and forever power, the script checks to see if a player is in a group and if they are ranked as a moderator. If they are a moderator a button becomes visible for them to click to get the ban gui to show up |
|
|
| Report Abuse |
|
|
|
| 17 Sep 2015 09:56 PM |
| That would work in theory, but a hacker could still fire the event without having the button displayed on their screen. |
|
|
| Report Abuse |
|
|
| |
|
|
| 17 Sep 2015 10:29 PM |
| How would i unban the player now? Like remove them from the datastore? |
|
|
| Report Abuse |
|
|
|
| 17 Sep 2015 10:30 PM |
| should i change it from true to false? |
|
|
| Report Abuse |
|
|