At the moment I have a script that gives a player a stringvalue called "CurrentRace" (which decides their race). But at the moment if they die with the current race stringvalue they lose their race, how would I make it so the currentrace automatically replicates into the new character?
-- ev 3/2/2021
Players.PlayerAdded:Connect(function(player)
repeat
wait()
until
player.Character
local chosenRace = races[math.random(1,#races)]
player.Character:WaitForChild("CurrentRace").Value = chosenRace
if chosenRace == "Forturs" then
local roll2 = math.random(1,2)
if roll2 == 1 then
local colour = Color3.fromRGB(170, 0, 0) -- fill this RGB value in
local bodyColours = player.Character:WaitForChild("Body Colors")
bodyColours.HeadColor3 = colour
bodyColours.LeftArmColor3 = colour
bodyColours.RightArmColor3 = colour
bodyColours.LeftLegColor3 = colour
bodyColours.RightLegColor3 = colour
bodyColours.TorsoColor3 = colour
end
if roll2 == 2 then
local colour = Color3.fromRGB(0, 170, 0) -- fill this RGB value in
local bodyColours = player.Character:WaitForChild("Body Colors")
bodyColours.HeadColor3 = colour
bodyColours.LeftArmColor3 = colour
bodyColours.RightArmColor3 = colour
bodyColours.LeftLegColor3 = colour
bodyColours.RightLegColor3 = colour
bodyColours.TorsoColor3 = colour
end
else
if chosenRace == "Hahns" then
local colour = Color3.fromRGB(0, 85, 255) -- fill this RGB value in
local bodyColours = player.Character:WaitForChild("Body Colors")
bodyColours.HeadColor3 = colour
bodyColours.LeftArmColor3 = colour
bodyColours.RightArmColor3 = colour
bodyColours.LeftLegColor3 = colour
bodyColours.RightLegColor3 = colour
bodyColours.TorsoColor3 = colour
local clone = game.ServerStorage.Barbarity
clone.Parent = player.Character
else
if chosenRace == "Yitals" then
local colour = Color3.fromRGB(248, 255, 201) -- fill this RGB value in
local bodyColours = player.Character:WaitForChild("Body Colors")
bodyColours.HeadColor3 = colour
bodyColours.LeftArmColor3 = colour
bodyColours.RightArmColor3 = colour
bodyColours.LeftLegColor3 = colour
bodyColours.RightLegColor3 = colour
bodyColours.TorsoColor3 = colour
else
if chosenRace == "Pardeos" then
local colour = Color3.fromRGB(255, 255, 255) -- fill this RGB value in
local bodyColours = player.Character:WaitForChild("Body Colors")
bodyColours.HeadColor3 = colour
bodyColours.LeftArmColor3 = colour
bodyColours.RightArmColor3 = colour
bodyColours.LeftLegColor3 = colour
bodyColours.RightLegColor3 = colour
bodyColours.TorsoColor3 = colour
end
end
end
end
end)

6 comments
It works, thanks for the improvement! But now the race resets upon dying, (CurrentRace still clones but it resets the race back to Raceless)
I updated the post with the rolling script. it's very messy but where would i be able to make it so based on their chosenrace it would stay even if they died?
You could also just parent it under player, which would require PlayerAdded. Anytime they reset it won't go away
It works, but the skin tone is removed, how would I keep the skin tone when it resets (your suggestion did work so I'll accept the answer) but this is just a secondary question.
You can always save it to a table, too
What do you mean by that? Do you mean store the RGB colors into a table, if so how would I do that and how would it save it upon the character dying?