Hi! I'm having issues with a Uniform system I'm rescripting, anyways
When I attempt to return a table of values, it returns all but one.
RemoveHats = true, addExpunger = false, addNVG = false, addScramble = false, -- ArmourPos = game.ServerStorage.Armours.SRU.Brigadier, is missing Health = 115
But it should return:
RemoveHats = true, addExpunger = false, addNVG = false, addScramble = false, ArmourPos = game.ServerStorage.Armours.SRU.Brigadier, Health = 115
Here's my function that returns the list
function getPlayerMorphForRank(player, playerrank, teamarmour) if VIP[player.UserId] then return teamarmour["VIP"] end local playerMorph if playerMorph == nil then for rank, info in ipairs(teamarmour) do if rank ~= "isSingleRank" then -- if player rank is greater than armour, set armour val then continue -- if it's equal to the rank, set rank and break -- if player rank is lower than armour, continue if playerrank > rank then playerMorph = info elseif playerrank < rank then continue elseif playerrank == rank then return info end end end end return playerMorph end
Here is the script that calls the function
local teamArmour = armourhandling[TeamName] if teamArmour["isSingleRank"] == true then if teamArmour["addExpunger"] then AddExpunger(Player) end if teamArmour["addNVG"] then AddNVG(Player) end if teamArmour["addScramble"] then AddScramble(Player) end ArmourEquip(Player, teamArmour["RemoveHats"], teamArmour["ArmourPos"], teamArmour["Health"]) else if Player:GetRankInGroup(Groups[TeamName]) > 0 or VIP[Player.UserId] == true then local playerrank = Player:GetRankInGroup(Groups[TeamName]) local rankArmour = getPlayerMorphForRank(Player, playerrank, teamArmour) print(playerrank, rankArmour) if rankArmour ~= nil then print(string.format("Found uniform for %s with uniform of %s.", Player.Name, tostring(rankArmour["ArmourPos"]))) if rankArmour["addExpunger"] then AddExpunger(Player) end if rankArmour["addNVG"] then AddNVG(Player) end if rankArmour["addScramble"] then AddScramble(Player) end if rankArmour["ArmourPos"] ~= nil then ArmourEquip(Player, rankArmour["RemoveHats"], rankArmour["ArmourPos"], rankArmour["Health"]) end else print(string.format("Cannot find uniform for %s's rank, %s.", Player.Name, playerrank)) end end end
My table looks like this
["Specialized Response Unit"] = { isSingleRank = false, [1] = { -- group rank RemoveHats = true, addExpunger = false, addNVG = false, addScramble = false, ArmourPos = nil, Health = 115 }, [3] = { RemoveHats = true, addExpunger = false, addNVG = false, addScramble = false, ArmourPos = game.ServerStorage.Armours.SRU.Agent, Health = 115 }, [4] = { RemoveHats = true, addExpunger = false, addNVG = false, addScramble = false, ArmourPos = game.ServerStorage.Armours.SRU.Brigadier, Health = 115 }, --[so on and so forth...] },
it might be because of "continue" because that isn't used in ROBLOX Lua
I probably shouldn't have included lines 14 and 15 on the third script from the top, basically deadmeat