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

How to fix the remote color?

Asked by 4 years ago
Edited 4 years ago

So im trying to make an Admin Only GUI that will affect a certain block within my game. The problem im having is im trying to have a textbox with an inputted text, then upon pressing the button beside it, the color of the block will change. However, It does not.

What ive done: - Placed a Color3 Value within the part - Have a local script with the following code in the button:

script.Parent.MouseButton1Click:Connect(function()
    local rep = game:GetService("ReplicatedStorage")
    local text = script.Parent.Parent.Text
        local value = workspace.RenderedVisualiserPart.ColorValue
        rep.ColorRemote:FireServer(script.Parent.Parent.Text)
        value.Value = Color3.fromRGB(text)
end)

I have a remote within ReplicatedStorage called "ColorRemote" The remote is fired by the click, then sent to the following code

    ReplicatedStorage.ColorRemote.OnServerEvent:Connect(function(Player,SupportedArgument)
        for i,v in pairs(AllowedUserIds) do
            if Player.UserId ~= v then

            else
                while true do
                    wait(0.1)
                    local text = game.StarterGui.AdminPanel.AdminGUI.MainFrame.Color.Text
                    local colorValue = workspace.RenderedVisualiserPart.ColorValue
                    colorValue.Value = Color3.fromRGB(text)
                    --local colorval = game.StarterGui.AdminPanel.AdminGUI.MainFrame.Color.Text
                    -- local visPart = workspace:FindFirstChild("RenderedVisualiserPart")
                    workspace.RenderedVisualiserPart.Color = colorValue.Value
                end
            end
        end
    end)

After trying numerous ways to potentially do this, the text from the "Textbox" does not get sent to the Color3Value I have to be able to change the Part color. If you are able to help, please do. If you need more details, Send me a friend Request on Discord. My Tag is: Oblivion?#0003

Thanks!

For an easier version, how can I turn the text value into the RGB. Since

Color3.fromRGB(text) wouldnt work

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

Your issue

To send a certain color to the server, you need to send it through your RemoteEvent. In your Server Script, you have the brick go to the same color it's already set to. local text = game.StarterGui.AdminPanel.AdminGUI.MainFrame.Color.Text, anything that happens through the client stays on the client unless it's sent to the server through a RemoteEvent.

My Scripts

You'll need to make changes accordingly to make the scripts below work with your system.

Local Script for the Button

--Made By MillerrIAm
script.Parent.MouseButton1Click:Connect(function()
    local rep = game:GetService("ReplicatedStorage")
    local Color2ChangeTo = Color3.fromRGB(255,0,0)
        rep.ColorRemote:FireServer(Color2ChangeTo)
end)

Server Script

--Made By MillerrIAm
ReplicatedStorage.ColorRemote.OnServerEvent:Connect(function(Player,Color)
    for i,v in pairs(AllowedUserIds) do
        if Player.UserId ~= v then

        else
            while true do
                wait(0.1)
                colorValue.Value = Color --Since you're sending the Color3 value through the remote event, you won't need to add the Color3.fromRGB value. I'm assuming the ColorValue is a Color3 Bool Value.
            end
        end
    end
end)
0
But how would I take the text from the InputBox to use as the color value to change to? Ive tried to do parent.Text, and nothing would work Xzenerne 0 — 4y
0
On the button script, i tried doing `script.Parent.MouseButton1Click:Connect(function() local inputText = game.StarterGui.AdminPanel.AdminGUI.MainFrame.Color.Text local rep = game:GetService("ReplicatedStorage") local Color2ChangeTo = Color3.fromRGB(inputText) rep.ColorRemote:FireServer(Color2ChangeTo) end)` Xzenerne 0 — 4y
Ad

Answer this question