Oh, this is for color choosing, not the game itself
Shouldn’t be an exploiting issue if it’s just Color3
s coming in from :FireServer
right? It’s not really important towards the game.
Katrist:
Yes.
Once the data is received to the client it cannot be altered?
local players = game:GetService("Players")
local DSS = game:GetService("DataStoreService")
local DS = DSS:GetDataStore("ds")
local controllerMod = require(game.ReplicatedStorage.modules.teamManager)
local utilities = require(game.ReplicatedStorage.modules.utilities)
local baseModels = game.ReplicatedStorage.basePlayerModels
local baseHairs = game.ReplicatedStorage.baseHairs
local CleetColors = {"Blue", "Green", "Yellow", "Black", "White", "Pink"}
local offensive = {"QB", "RB", "WR","OL", "TE"}
local defensive = {"SS", "DL", "CB", "FS", "MLB", "ROLB", "LOLB"}
local firstNames = {"Calvin", "Eoin", "Luis", "Brendan", "Alessandro", "Prince", "Abdul", "Abbas", "Olly", "Albert", "Adam", "Ridwan", "Damon", "Corey", "DeAndre", "Aiden", "Elijah", "Marc", "Hayden", "Donavin"}
local lastNames = {"Evans", "Hayes", "Hill", "Taylor", "Bennett", "Washington", "Wallace", "O'Brien", "Rodriguez", "Davis", "Young", "Ward", "Reynolds", "Collins", "Martin", "Robinson", "Mithchell", "West", "Smith", "Brown"}
local importance = {
["QB"] = 80,
["RB"] = 40,
["WR"] = 60,
["OL"] = 35,
["SS"] = 45,
["DL"] = 40,
["CB"] = 45,
["FS"] = 45,
["MLB"] = 40,
["ROLB"] = 40,
["LOLB"] = 40,
["TE"] = 20
}
local statsNeeded = {
["QB"] = {
"Speed", "TAS", "TAM", "TAL", "Break Sack", "Throw Power", "Injury"
},
["RB"] = {
"Speed", "Break Tackle", "Catching", "Injury", "Range"
},
["WR"] = {
"Speed", "Break Tackle", "Catching", "Injury", "Range"
},
["OL"] = {
"Speed", "Blocking", "Injury"
},
["SS"] = {
"Break Pass", "Speed", "Range", "Catching", "Injury", "Tackling"
},
["CB"] = {
"Break Pass", "Speed", "Range", "Catching", "Injury", "Tackling"
},
["FS"] = {
"Break Pass", "Speed", "Range", "Catching", "Injury", "Tackling"
},
["DL"] = {
"Speed", "Rush", "Injury", "Tackling"
},
["MLB"] = {
"Break Pass", "Speed", "Range", "Catching", "Injury", "Tackling"
},
["LOLB"] = {
"Break Pass", "Speed", "Range", "Catching", "Injury", "Tackling"
},
["ROLB"] = {
"Break Pass", "Speed", "Range", "Catching", "Injury", "Tackling"
},
["TE"] = {
"Speed", "Range", "Catching", "Injury", "Break Tackle"
}
}
local maxStat = {
["QB"] = {
["Speed"] = 92
},
["OL"] = {
["Speed"] = 70
},
["DL"] = {
["Speed"] = 70
},
["RB"] = {
["Range"] = 87,
["Catching"] = 88,
},
["MLB"] = {
["Speed"] = 88
},
["ROLB"] = {
["Speed"] = 88
},
["LOLB"] = {
["Speed"] = 88
},
["TE"] = {
["Speed"] = 88,
},
}
local minStat = {
["RB"] = {
["Speed"] = 83,
},
["WR"] = {
["Speed"] = 80,
["Catching"] = 70,
},
["SS"] = {
["Speed"] = 80,
["Catching"] = 70,
["Break Pass"] = 70
},
["FS"] = {
["Speed"] = 80,
["Catching"] = 70,
["Break Pass"] = 70
},
["CB"] = {
["Speed"] = 80,
["Catching"] = 70,
["Break Pass"] = 70
},
["TE"] = {
["Break Tackle"] = 70,
["Catching"] = 80,
["Speed"] = 75,
["Range"] = 70
}
}
function generateTeam()
local team = {}
local teamToIterate = {}
local availablePositions = {"QB", "RB", "WR", "SS", "TE", "OL", "DL", "CB", "FS", "MLB", "ROLB", "LOLB"}
local available = {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}
for i = 0, 25, 1 do
local basePlrModels = baseModels:GetChildren()
local hairBases = baseHairs:GetChildren()
local baseNum = utilities.random(1, #basePlrModels)
local SkinBaseModel = baseModels:FindFirstChild("base_"..baseNum)
if not SkinBaseModel then return end
local hairBaseNum = math.random(1, #hairBases)
local charHair = baseHairs:FindFirstChild("hair_"..hairBaseNum)
if not charHair then return end
local player = utilities.createTable()
player.cleetColor = CleetColors[utilities.random(1, #CleetColors)]
player.baseModel = SkinBaseModel
player.hair = charHair
local randomPosNum = utilities.random(1, #availablePositions)
player.position = availablePositions[randomPosNum]
available[randomPosNum] -= 1
local first_name_Num = utilities.random(1, #firstNames)
local firstName = firstNames[first_name_Num]
local lastName_Num = utilities.random(1, #lastNames)
local lastName = lastNames[lastName_Num]
player.name = firstName.." "..lastName
if available[randomPosNum] == 0 then
table.remove(availablePositions, randomPosNum)
end
player.overalls = {}
local len
for i, v in pairs(statsNeeded[player.position]) do
if v == "Injury" then
player.overalls[v] = utilities.random(85, 99)
else
local min
local max
if minStat[player.position] and minStat[player.position][v] then min = minStat[player.position][v] else min = 65 end
if maxStat[player.position] and maxStat[player.position][v] then max = maxStat[player.position][v] else max = 99 end
player.overalls[v] = utilities.random(min, max)
end
len = i
end
player.totalOverall = math.round(utilities.calculateTable(player.overalls)/len)
player.importance = importance[player.position]
player.morale = utilities.random(50, 100)
player.contract = {}
player.contract.length = utilities.random(1, 5)
player.contract.salary = utilities.random(10000000 + (10000000 * player.totalOverall/100) + (10000000 * player.importance/100) - 1000000 * player.morale/10 , 30000000 + (10000000 * player.totalOverall/100) + (10000000 * player.importance/100) - 1000000 * player.morale/10)
player.contract.total = player.contract.length * player.contract.salary
table.insert(teamToIterate, player)
end
team.offense = {}
team.defense = {}
for i, v in pairs(teamToIterate) do
if table.find(offensive, v.position) then
table.insert(team.offense, v)
elseif table.find(defensive, v.position) then
table.insert(team.defense, v)
end
end
warn("A team has just been generated!")
return team
end
players.PlayerAdded:Connect(function(plr)
local team = {}
local data = DS:GetAsync(plr.UserId.."-stats")
if not data then
local roster = generateTeam()
team.roster = roster
game.ReplicatedStorage.events.chooseColors:InvokeClient(plr)
local primary, secondary = game.ReplicatedStorage.events.chooseColors:InvokeClient(plr)
team.colors = {}
team.colors.primary = primary
team.colors.secondary = secondary
else
if data.joined == true then
team = data.team
else
local roster = generateTeam()
team.roster = team
local primary, secondary = game.ReplicatedStorage.events.chooseColors:InvokeClient(plr)
team.colors = {}
team.colors.primary = primary
team.colors.secondary = secondary
end
end
print(team)
end)
This won’t cost as much resources as continually sending data back and forth?