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:

local replicatedStorage = game:GetService("ReplicatedStorage")
local Storage = game.ReplicatedStorage.Customization.HairColor
local Hair = game.ReplicatedStorage.Customization.Hair
local FemHair = game.ReplicatedStorage.Customization.FemaleHair



script.Parent.Click.MouseButton1Click:Connect(function()
    Storage.HairColor2:FireServer()

    Hair.MHair1.Handle.Color = Color3.fromRGB(59, 59, 59)
    Hair.MHair2.Handle.Color = Color3.fromRGB(59, 59, 59)
    FemHair.FHair1.Handle.Color = Color3.fromRGB(59, 59, 59)
    FemHair.FHair2.Handle.Color = Color3.fromRGB(59, 59, 59)

Server:

game.ReplicatedStorage.Customization.HairColor.HairColor1.OnServerEvent:Connect(function(plr)
    local char = plr.Character
    local Hair1 = char:WaitForChild("Hair")
    local Storage = game.ReplicatedStorage.Customization.HairColor
    local Hair = game.ReplicatedStorage.Customization.Hair
    local FemHair = game.ReplicatedStorage.Customization.FemaleHair


    Hair1.Handle.Color = Color3.fromRGB(59,59,59)
    --Hair.MHair1.Handle.Color = Color3.fromRGB(59, 59, 59)
    --Hair.MHair2.Handle.Color = Color3.fromRGB(59, 59, 59)
    --FemHair.FHair1.Handle.Color = Color3.fromRGB(59, 59, 59)
    --FemHair.FHair2.Handle.Color = Color3.fromRGB(59, 59, 59)

Answer this question