I want to create prison team in game and script which will prevent prisoners from escape by re-join. I tested that on roblox 2 times and nothing happened. Script type is standard script and location is workspace. Here's the code:
game.Players.PlayerRemoving:connect(function(player)
if player.TeamColor == BrickColor.new("Medium stone grey") then
local datastore = game:GetService("DataStoreService"):GetDataStore(player.TeamColor)
datastore:SetAsync(player.TeamColor)
end
end)
game.Players.PlayerAdded:connect(function(player)
local datastore = game:GetService("DataStoreService"):GetDataStore(player.TeamColor)
player.TeamColor = datastore:GetAsync(player.TeamColor)
end)
