ok so here is the script.I want to change to persons skin Color to "Terra Cotta" and it does but the problem is how do I get their original Skin Color back when I press E? The person just stays as The Terra Cotta Color for ever...
local uis = game:GetService("UserInputService") local ruse = false uis.InputBegan:Connect(function(input) if input.KeyCode == Enum.KeyCode.E then game.Players.LocalPlayer.Character.UpperTorso.BrickColor = BrickColor.new("Terra Cotta") game.Players.LocalPlayer.Character.LeftFoot.BrickColor = BrickColor.new("Terra Cotta") game.Players.LocalPlayer.Character.LeftHand.BrickColor = BrickColor.new("Terra Cotta") game.Players.LocalPlayer.Character.LowerTorso.BrickColor = BrickColor.new("Terra Cotta") game.Players.LocalPlayer.Character.RightFoot.BrickColor = BrickColor.new("Terra Cotta") game.Players.LocalPlayer.Character.RightHand.BrickColor = BrickColor.new("Terra Cotta") game.Players.LocalPlayer.Character.RightLowerArm.BrickColor = BrickColor.new("Terra Cotta") game.Players.LocalPlayer.Character.RightUpperArm.BrickColor = BrickColor.new("Terra Cotta") game.Players.LocalPlayer.Character.RightLowerLeg.BrickColor = BrickColor.new("Terra Cotta") game.Players.LocalPlayer.Character.RightUpperLeg.BrickColor = BrickColor.new("Terra Cotta") game.Players.LocalPlayer.Character.RightUpperArm.BrickColor = BrickColor.new("Terra Cotta") game.Players.LocalPlayer.Character.LeftUpperLeg.BrickColor = BrickColor.new("Terra Cotta") game.Players.LocalPlayer.Character.LeftLowerLeg.BrickColor = BrickColor.new("Terra Cotta") game.Players.LocalPlayer.Character.LeftUpperArm.BrickColor = BrickColor.new("Terra Cotta") game.Players.LocalPlayer.Character.LeftLowerArm.BrickColor = BrickColor.new("Terra Cotta") game.Players.LocalPlayer.Character.Head.BrickColor = BrickColor.new("Terra Cotta") end end) --local uis = game:GetService("UserInputService") --uis.InputBegan:Connect(function(input) -- if input.KeyCode == Enum.KeyCode.F then -- -- end -- end)
By the way this is a local script.
Save the skin color for each of the players parts in a temporary table when they press E the first time then make a debounce so for example:
local EPressed = false if EPressed == false then --Change their color. elseif EPressed == true then --Turn their color back end
After the first time it will log their skin color for their parts in a temp table and when they press E the second time it grabs from that table for each part and changes it to the color logged.
Example
local EPressed = false local player = game.Players.LocalPlayer local colorTable = {} if EPressed == false then EPressed = true for i,v in pairs(player.Character:GetChildren()) do if v:IsA("BasePart") or v:IsA("MeshPart") then table.Insert(colorTable, v.BrickColor) v.BrickColor = BrickColor.new("Terra Cotta") end end elseif EPressed == true then EPressed = false for i,v in pairs(player.Character:GetChildren()) do if v:IsA("BasePart") or v:IsA("MeshPart") then v.BrickColor = BrickColor.new(colorTable[i]) end end end
BrickColor
. And adding on to LegitimateTrade's answer, you could have a boolean to check if it was pressed.local Players = game:GetService("Players") local player = Players.LocalPlayer -- to prevent having to type out the full thing local character = player.Character or plr.CharacterAdded:Wait() local enabled = false -- We will set to true when button is pressed local tc = "Terra Cotta" -- brick colour local bodyColours = {} -- blank table that we will add body colours to. uis.InputBegan:Connect(function(input, gpe) if gpe then return end -- stop if they're chatting if input.KeyCode == Enum.KeyCode.E then enabled = not enabled -- set to the opposite of current state for _, v in pairs(character:GetChildren()) do -- loop through children if v:IsA("BasePart") then -- in the char, only parts have brick colours table.insert(bodyColours, v.BrickColor) -- save obj end end if enabled then -- if it's enabled for _, v in pairs(character:GetChildren()) do -- another for loop if v:IsA("BasePart") then v.BrickColor = BrickColor.new(tc) end end else-- it's not enabled, reset their brick colours for _, v in pairs(character:GetChildren()) do if v:IsA("BasePart") then for _, colour in pairs(bodyColours) do v.BrickColor = colour end end end end end end)
local uis = game:GetService("UserInputService") local ruse = false uis.InputBegan:Connect(function(input) local BodyColors = game:GetService("Players").LocalPlayer.Character:WaitForChild("Body Colors") if input.KeyCode == Enum.KeyCode.E and ruse == false then BodyColors.HeadColor3 = Color3.fromRGB(190, 104, 98) BodyColors.HeadColor3 = Color3.fromRGB(190, 104, 98) BodyColors.LeftArmColor3 = Color3.fromRGB(190, 104, 98) BodyColors.LeftLegColor3 = Color3.fromRGB(190, 104, 98) BodyColors.RightArmColor3 = Color3.fromRGB(190, 104, 98) BodyColors.RightLegColor3 = Color3.fromRGB(190, 104, 98) BodyColors.TorsoColor3 = Color3.fromRGB(190, 104, 98) ruse = true elseif input.KeyCode == Enum.KeyCode.E and ruse == true then BodyColors.HeadColor3 = Color3.fromRGB(255, 204, 153) BodyColors.HeadColor3 = Color3.fromRGB(255, 204, 153) BodyColors.LeftArmColor3 = Color3.fromRGB(255, 204, 153) BodyColors.LeftLegColor3 = Color3.fromRGB(255, 204, 153) BodyColors.RightArmColor3 = Color3.fromRGB(255, 204, 153) BodyColors.RightLegColor3 = Color3.fromRGB(255, 204, 153) BodyColors.TorsoColor3 = Color3.fromRGB(255, 204, 153) ruse = false end end)