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

How can I make a brickcolor script visible to everyone in the server with FE enabled?

Asked by 7 years ago

So a colour script wouldn't allow anyone in the server to see the parts that were coloured. Instead I wrote a remote event script, which has the same error. Help? To confirm, it DOES colour but only for the localplayer, everyone else sees uncoloured models.

This is the client script

local player = game.Players.LocalPlayer
local data = script.Parent
local event = game.ReplicatedStorage:WaitForChild("ColouringEvent")
script.Parent.MouseButton1Click:Connect(function()
    print('firing')
    event:FireServer(data.Name)
    print('fired')
end)

This is the server script

local event = game.ReplicatedStorage:WaitForChild("ColouringEvent")
event.OnServerEvent:Connect(function(player, colour)
    local Target = game.ReplicatedStorage.Target
    print(Target.Value)
    print('Target')
    local character = player.Character or player.CharacterAdded:wait()
    local Parts = character:GetChildren()
    for i = 1, #Parts do
        if Parts[i].ClassName == "Model" then
            local Get = Parts[i]:GetChildren()
            for i = 1, #Get do
                print(Get[i].Name)
                print(Target.Value)
                if Get[i].Name == Target.Value then
                    Get[i].BrickColor = BrickColor.new(colour)
                end
            end
        end
    end
end)

Answer this question