I’m not very sure of the problem your having but if your looking to give a random role to a player that joins I think this should do it
local Players = game:GetService("Players") -- Players Service
local Roles = {"Role1","Role2"} -- The roles that are available for the players
Players.PlayerAdded:Connect(function(plr) -- Function Connects when Player joins
local Select = Instance.new("StringValue",plr) -- Create the Role String Value
Select.Name = "Role" -- Give it a Name
Select.Value = Roles[math.random(1,#Roles)] -- Give the Role to the player
end)