You can write your topic however you want, but you need to answer these questions:
- What do you want to achieve? Keep it simple and clear!
I am trying to make it so when a player clicks a GUI button, a brick will turn that color.
- What is the issue? Include screenshots / videos if possible!
The issue is when I try to send R, G, and B values through a remote event the event somehow makes R all three (If I print R it will print all 3 values under R and make G and B return nil). Here’s some pics of the output and the scripts.
Local script:
local Player = game.Players.LocalPlayer
local BB = script.Parent.TextButton_Roundify_12px.ImageColor3.B
local RR = script.Parent.TextButton_Roundify_12px.ImageColor3.R
local GG = script.Parent.TextButton_Roundify_12px.ImageColor3.G
print(script.Parent.TextButton_Roundify_12px.ImageColor3.B)
print(script.Parent.TextButton_Roundify_12px.ImageColor3.R)
print(script.Parent.TextButton_Roundify_12px.ImageColor3.G)
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remoteEvent = ReplicatedStorage:WaitForChild("ChangeColor")
function leftClick()
remoteEvent:FireServer(RR,GG,BG)
end
function rightClick()
end
script.Parent.MouseButton1Click:Connect(leftClick)
script.Parent.MouseButton2Click:Connect(rightClick)
Server-side
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remoteEvent = ReplicatedStorage:WaitForChild("ChangeColor")
local function onChangecolor(player,RR,GG,BB)
print(player.Name .. " Changed the color to" )
print(RR)
print(GG)
print(BB)
print(game.Workspace.Part.Color)
game.Workspace.Part.Color = Color3.fromRGB(RR,BB,GG)
print(game.Workspace.Part.Color)
wait(5)
game.Workspace.Part.Color = Color3.new(RR,BB,GG)
end
remoteEvent.OnServerEvent:Connect(onChangecolor)
Output:
- What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I tried changing variable names (as explains the AA, BB type of approach) thinking that was the issue. Turns out that was not the issue. As you can see I also did two methods in hopes to get a better (if not any) result from the other method. Unfortunately, none of this worked.