So I made this script where it copies the HeadColor3 Value of the BodyColors to a Color3 Value I made. So I want the player’s body color to change to blue if their humanoid state is Swimming. But if the State is Landed then it makes the body colors to their default. But I don’t know how to get the default Body Colors. This is my script:
local Humanoid = script.Parent:WaitForChild("Humanoid")
Humanoid.StateChanged:Connect(function(oldState, newState)
if Humanoid:GetState() == Enum.HumanoidStateType.Swimming then
print("swimming")
script.Infected.Value = true
end
end)
Humanoid.StateChanged:Connect(function(oldState, newState)
if Humanoid:GetState() == Enum.HumanoidStateType.Landed then
print("landed")
script.Infected.Value = false
end
end)
local BColor = script.Parent:WaitForChild("Body Colors")
local IValue = script.Infected
IValue.Changed:Connect(function()
if IValue.Value == true then
BColor.HeadColor3 = Color3.new(0.145098, 0.823529, 0.972549)
BColor.TorsoColor3 = Color3.new(0.145098, 0.823529, 0.972549)
BColor.LeftArmColor3 = Color3.new(0.145098, 0.823529, 0.972549)
BColor.RightArmColor3 = Color3.new(0.145098, 0.823529, 0.972549)
BColor.LeftLegColor3 = Color3.new(0.145098, 0.823529, 0.972549)
BColor.RightLegColor3 = Color3.new(0.145098, 0.823529, 0.972549)
else if IValue.Value == false then
BColor.HeadColor3 = Color3.new()
BColor.TorsoColor3 = Color3.new()
BColor.LeftArmColor3 = Color3.new()
BColor.RightArmColor3 = Color3.new()
BColor.LeftLegColor3 = Color3.new()
BColor.RightLegColor3 = Color3.new()
end
end
end)
