|
| 31 Jan 2017 12:57 PM |
--Would post datastore part but roblox hashtags it out so here:
local kerr = ('server-'..game.PlaceId) local kickr = { "newcoolman2", "Player2", }
function start() if DataStore:GetAsync(kerr) ~= nil then kickr = DataStore:GetAsync(kerr) else DataStore:SetAsync(kerr, kickr) end end
|
|
|
| Report Abuse |
|
|
|
| 31 Jan 2017 12:58 PM |
| I had to make it a function because it holds all the other code under it, like a player added and etc... from completely working..! |
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 31 Jan 2017 01:14 PM |
Why no help?
My new siggy; c(ˆ▿ˆc) |
|
|
| Report Abuse |
|
|
Casualist
|
  |
| Joined: 26 Jun 2014 |
| Total Posts: 4443 |
|
|
| 31 Jan 2017 01:14 PM |
| http://wiki.roblox.com/index.php?title=Data_store#Tables_with_mixed_list_.2F_record_style_will_be_cut_off |
|
|
| Report Abuse |
|
|
|
| 31 Jan 2017 01:16 PM |
| Try to save names... what would you recommend... :C |
|
|
| Report Abuse |
|
|
C_Sharper
|
  |
| Joined: 03 Oct 2011 |
| Total Posts: 6405 |
|
|
| 31 Jan 2017 01:33 PM |
| ############################################################################# ^.^ |
|
|
| Report Abuse |
|
|
|
| 31 Jan 2017 01:36 PM |
local kickr = { [1]="newcoolman2", [2]="Player2", }
game.Loaded:connect(function() --easy fix if DataStore:GetAsync(kerr) ~= nil then kickr = DataStore:GetAsync(kerr) else DataStore:SetAsync(kerr, kickr) end end)
That works but now: doesn't work
game.Players.PlayerAdded:connect(function(plr) if plr and kickr[plr.Name] == nil then --if player is in the table.
else
plr:kick()
end end) |
|
|
| Report Abuse |
|
|
|
| 31 Jan 2017 01:40 PM |
| Hey look, roblox didn't turn the entire post to hashtags... again... |
|
|
| Report Abuse |
|
|
|
| 31 Jan 2017 01:49 PM |
| Wow, my 'new' siggy lasted like 3 posts... |
|
|
| Report Abuse |
|
|
Casualist
|
  |
| Joined: 26 Jun 2014 |
| Total Posts: 4443 |
|
|
| 31 Jan 2017 01:50 PM |
| You need to review how tables work. |
|
|
| Report Abuse |
|
|
| |
|
|
| 31 Jan 2017 01:59 PM |
@Casual
http://wiki.roblox.com/index.php?title=Table#Pass_by_reference
That's what I'm doing...
Table[ObjectName]...
Should I do numbers, because I don't want to loop through every time a player joins.
local kickr = { [1]="newcoolman2", --my table [2]="Player2", } |
|
|
| Report Abuse |
|
|
Kutoru
|
  |
| Joined: 22 May 2016 |
| Total Posts: 288 |
|
|
| 31 Jan 2017 02:03 PM |
try JSONEncode i didn't read anything |
|
|
| Report Abuse |
|
|
| |
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 31 Jan 2017 02:05 PM |
https://forum.roblox.com/Forum/ShowPost.aspx?PostID=201595803 https://www.roblox.com/library/618161558/Basic-DataStore-Example
|
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 31 Jan 2017 02:09 PM |
local banned = {}
game.PlayersAdded:connect(function(player) local data = ds:GetAsync('BanData') if (data and data[player.userid]) or banned[player.Name] then player:Kick() end end
|
|
|
| Report Abuse |
|
|
|
| 31 Jan 2017 02:58 PM |
| table.insert(banned,p.UserId) |
|
|
| Report Abuse |
|
|
|
| 31 Jan 2017 03:01 PM |
local data = ds:GetAsync('server;'..game.PlaceId) if (data and data[plr.UserId]) then print('not allowed') plr:Kick('Banned') end
Doesn't work with @above |
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 31 Jan 2017 03:28 PM |
| what do you mean datastore broke? Is the data not saving? or is the problem with your script that utilises the data store to do stuff |
|
|
| Report Abuse |
|
|
|
| 31 Jan 2017 03:57 PM |
--I'm using: --
table.insert(banned,p.UserId)
--this doesn't work with playeradded: --
local data = ds:GetAsync('server;'..game.PlaceId) if (data and data[plr.UserId]) then print('not allowed') plr:Kick('Banned') end |
|
|
| Report Abuse |
|
|
|
| 31 Jan 2017 04:04 PM |
game.Players.PlayerAdded:connect(function(Player) local Admin = false for i, v in pairs(kickr) do if v == Player.Name then Admin = true end end if Admin then else Player:Kick() end end) |
|
|
| Report Abuse |
|
|