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)
First, you haven't :Clone()'d the "clone" variable, also, you could just place the StringValue inside of StarterCharacter, as everything under StarterCharacter gets automatically placed inside of a players character.