Hi I am Mr Doge (soon getting a name change). I am decent in scripting and pretty good at building. I need help with this script I’m struggling on. There is a folder in replicated storage called Body, and inside the folder are 6 parts, Head, Right Arm, Right Leg, Left Leg, Left Arm, and Torso. My goal is so whenever a person joins, the color of all 6 of their body parts matches to the ones in replicated storage folder. So for instance, lets say a person with green head and torso, and purple legs and arms joins. The head and torso in the replicated storage will also turn green, and the arms and legs turn purple. I want this to be local so its not purple and green for everyone. so lets say a person who has all 6 body parts as pink join. Their body parts in storage will all turn pink. I want these to be local so It doesn’t turn pink for the purple and green person’s game.
local Head2 = game.ReplicatedStorage.Body.Head
local LeftArm2 = game.ReplicatedStorage.Body["Left Arm"]
local LeftLeg2 = game.ReplicatedStorage.Body["Left Leg"]
local RightArm2 = game.ReplicatedStorage.Body["Right Arm"]
local RightLeg2 = game.ReplicatedStorage.Body["Right Leg"]
local Torso2 = game.ReplicatedStorage.Body.Torso
Player = game.Players.LocalPlayer
Character = Player.Character
Head = Character.Head
LeftArm = Character["Left Arm"]
LeftLeg = Character["Left Leg"]
RightArm = Character["Right Arm"]
RightLeg = Character["Right Leg"]
Torso = Character.Torso
game.Players.PlayerAdded:Connect(function(Character)
Head2.Color = Head.Color
LeftArm2.Color = LeftArm.Color
LeftLeg2.Color = LeftLeg.Color
RightArm2.Color = RightArm.Color
RightLeg2.Color = RightLeg.Color
Torso2.Color = Torso.Color
end)
I would appreciate your help, I’ve been trying to work on this script for a while. Even if you aren’t able to help me, I’d appreciate the hard effort, and work for trying to help me.
Edit: so the purpose for this is, and their might be another way, but my goal is to make 2 blocks, 1 is mud and 1 is water. The mud turns the players skin brown. The water turns it back to normal. So If you have green limbs and pink head and torso and go in the mud, everything turns brown, but you go in the water and your head turns back to pink as well as the torso, and the limbs turn green. I’m making a show called Wipeout
You can’t use playeradded event in a local script and the playeradded event returns a player instance, so the character variable would actually be the player.
You most likely don’t want to change it locally, in the case that you’re doing some type of detection on the server.
A good workaround for this would be to just create a folder in ReplicatedStorage each time a player joins, which you can set/get their body part colors based on their name. Alternatively, you can create a dictionary containing the player data, so it would look something like this:
You can also loop through the character’s parts to get all of the body part colors to make it less repetitive, but I’ll give you the opportunity to figure that out on your own.
Also keep in mind you will want to remove the player from the table upon leaving the game.
Oh but keep in mind that Player.Character probably won’t be in the game when the script runs, so maybe put it in StarterCharacterScripts so it runs every time their character respawns.
also it is a little like confusing and I don’t know if it will work for what I need it for. What I need this for is I’m creating a show called wipeout and I want to create 2 blocks, a mud and water block. Mud changes the body part colors of the person to brown which I can script easily, The water block changes it back to normal. Thats why I want it to save so when player touches water block, it gets the colors its saved from replicated storage.
You’re going about this wrong, changes made to properties on the client don’t replicate to the server so it wouldn’t really work that way. A good way to do it is save the color of the player’s limbs before changing it, then changing it back to that color after some time.
local otherColor = Color3.new(0,0,0)
part.Touched:connect(function(hit)
if hit and hit:IsA("Part") and hit.Parent and hit.Parent:FindFirstChild("Humanoid") then
local normalColor = hit.Color
hit.Color = otherColor
wait(2)
hit.Color = normalColor
end
end
Optimally you wouldn’t want to use wait() at all, and you might want to add a debounce, this is just a simple example.