How to change a property of an object in replicated storage on the client?
Asked by
4 years ago Edited 4 years ago
So I have a hair color GUI that's supposed to change the color of all the hair in Replicated Storage. It works fine if I put it in a server script the problem with that is that it changes the color of everyone's hair on the server. I tried putting it into a local script and it changes the color of the hair but when i equip the hair it goes back to the default color. How would I make so I can the hairs property on the client side? Is it even possible? If not is there another place to store it or it just gonna be a tedious task of changing the color of the hair on equip?
local:
01 | local replicatedStorage = game:GetService( "ReplicatedStorage" ) |
02 | local Storage = game.ReplicatedStorage.Customization.HairColor |
03 | local Hair = game.ReplicatedStorage.Customization.Hair |
04 | local FemHair = game.ReplicatedStorage.Customization.FemaleHair |
08 | script.Parent.Click.MouseButton 1 Click:Connect( function () |
09 | Storage.HairColor 2 :FireServer() |
11 | Hair.MHair 1. Handle.Color = Color 3. fromRGB( 59 , 59 , 59 ) |
12 | Hair.MHair 2. Handle.Color = Color 3. fromRGB( 59 , 59 , 59 ) |
13 | FemHair.FHair 1. Handle.Color = Color 3. fromRGB( 59 , 59 , 59 ) |
14 | FemHair.FHair 2. Handle.Color = Color 3. fromRGB( 59 , 59 , 59 ) |
Server:
01 | game.ReplicatedStorage.Customization.HairColor.HairColor 1. OnServerEvent:Connect( function (plr) |
02 | local char = plr.Character |
03 | local Hair 1 = char:WaitForChild( "Hair" ) |
04 | local Storage = game.ReplicatedStorage.Customization.HairColor |
05 | local Hair = game.ReplicatedStorage.Customization.Hair |
06 | local FemHair = game.ReplicatedStorage.Customization.FemaleHair |
09 | Hair 1. Handle.Color = Color 3. fromRGB( 59 , 59 , 59 ) |