Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

how do i fix this body colours script from changing colours after the first death?

i'm trying to make a game that has races similar to rogue lineage but one of the races has a green variant and when a player joins this game and gets this race/variant the body colours look perfectly fine but after they die once the shade of green changes does anybody know how to fix this

elseif player:WaitForChild("RaceVariant").Value == "Green" then
	character:WaitForChild("Body Colors").HeadColor3 = Color3.fromRGB(137, 255, 124)
	character["Body Colors"].LeftArmColor3 = Color3.fromRGB(137, 255, 124)
	character["Body Colors"].LeftLegColor3 = Color3.fromRGB(137, 255, 124)
	character["Body Colors"].RightArmColor3 = Color3.fromRGB(137, 255, 124)
	character["Body Colors"].RightLegColor3 = Color3.fromRGB(137, 255, 124)
	character["Body Colors"].TorsoColor3 = Color3.fromRGB(137, 255, 124)

2 answers

Use LocalScript and put into StarterPlayerScripts

while wait() do
local player = game.Players.LocalPlayer
local character = workspace:WaitForChild(player.Name)
local bodycolors = character["Body Colors"]
	if character:FindFirstChild("Humanoid") then
   		bodycolors.HeadColor3 = Color3.fromRGB(137, 255, 124)
		bodycolors.LeftArmColor3 = Color3.fromRGB(137, 255, 124)
		bodycolors.LeftLegColor3 = Color3.fromRGB(137, 255, 124)
		bodycolors.RightArmColor3 = Color3.fromRGB(137, 255, 124)
		bodycolors.RightLegColor3 = Color3.fromRGB(137, 255, 124)
		bodycolors.TorsoColor3 = Color3.fromRGB(137, 255, 124)
	end
end

2 comments

0

unfortunately i've already tried this and on my screen the body colours would work fine but on other players' screens my character has my roblox avatar's body colours

0

it's work for me

In order to get it to load on the server (For Others to See) you must use a ServerScript place this code in a normal Script inside StarterCharacterScripts

local c = script.Parent
local bodycolors = c:WaitForChild("Body Colors")
if c:FindFirstChild("Humanoid") then
	bodycolors.HeadColor3 = Color3.fromRGB(137, 255, 124)
	bodycolors.LeftArmColor3 = Color3.fromRGB(137, 255, 124)
	bodycolors.LeftLegColor3 = Color3.fromRGB(137, 255, 124)
	bodycolors.RightArmColor3 = Color3.fromRGB(137, 255, 124)
	bodycolors.RightLegColor3 = Color3.fromRGB(137, 255, 124)
	bodycolors.TorsoColor3 = Color3.fromRGB(137, 255, 124)
end

2 comments

0

if you look at the start of the script that i posted the body colours will only change if the player's race variant is green and the race is fischeran but if i add game.Players.PlayerAdded:Connect(function(player) to define player to the script you posted then it doesn't work

0

You don't need to get the player from PlayerAdded if the player is the parent of the script, you can just do GetPlayerFromCharacter. (The character being script.Parent)

This discussion is preserved as it was. New answers, comments, and votes are closed.