Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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:

01local replicatedStorage = game:GetService("ReplicatedStorage")
02local Storage = game.ReplicatedStorage.Customization.HairColor
03local Hair = game.ReplicatedStorage.Customization.Hair
04local FemHair = game.ReplicatedStorage.Customization.FemaleHair
05 
06 
07 
08script.Parent.Click.MouseButton1Click:Connect(function()
09    Storage.HairColor2:FireServer()
10 
11    Hair.MHair1.Handle.Color = Color3.fromRGB(59, 59, 59)
12    Hair.MHair2.Handle.Color = Color3.fromRGB(59, 59, 59)
13    FemHair.FHair1.Handle.Color = Color3.fromRGB(59, 59, 59)
14    FemHair.FHair2.Handle.Color = Color3.fromRGB(59, 59, 59)

Server:

01game.ReplicatedStorage.Customization.HairColor.HairColor1.OnServerEvent:Connect(function(plr)
02    local char = plr.Character
03    local Hair1 = char:WaitForChild("Hair")
04    local Storage = game.ReplicatedStorage.Customization.HairColor
05    local Hair = game.ReplicatedStorage.Customization.Hair
06    local FemHair = game.ReplicatedStorage.Customization.FemaleHair
07 
08 
09    Hair1.Handle.Color = Color3.fromRGB(59,59,59)
10    --Hair.MHair1.Handle.Color = Color3.fromRGB(59, 59, 59)
11    --Hair.MHair2.Handle.Color = Color3.fromRGB(59, 59, 59)
12    --FemHair.FHair1.Handle.Color = Color3.fromRGB(59, 59, 59)
13    --FemHair.FHair2.Handle.Color = Color3.fromRGB(59, 59, 59)

Answer this question