I’m making a Lantern that displays a GUI upon the User equipping it. I want the user to be able to type in their own R, G, and B values so they can fully customize the color of the lanterns light. To do this, I referenced the values that the GUI had, and cast it over to the server side so it can change the color. What ends up happening, is when the player types in their R, G, and B values, it sets the color and the brick color to black, which is not supposed to be happening.
Example of GUI:
GUI is closable, but that only sets the Visible values of the GUI elements so it shouldn’t matter, just throwing it out there in case I’m wrong.
Here is my Script
(not a LocalScript)
-- RemoteEvent Portal --
local Portal = game.ReplicatedStorage.Bridge.ChangeAesthetics
-- Core Script --
local function onAestheticChangeReceived(Player, RValue, GValue, BValue)
Player.Character:WaitForChild("Mayonaka Lantern").LightPart.Color = Color3.fromRGB(RValue, GValue, BValue)
wait()
Player.Character:WaitForChild("Mayonaka Lantern").LightPart.PointLight.Color = Color3.fromRGB(RValue, GValue, BValue)
end
Portal.OnServerEvent:Connect(onAestheticChangeReceived)
Very basic, and not that long surprisingly.
Here is my LocalScript also if there is something wrong with that:
-- RemoteEvent Portal --
local Portal = game.ReplicatedStorage.Bridge.ChangeAesthetics
-- Extra Information --
local Player = game.Players.LocalPlayer
local LanternGUI = Player.PlayerGui:WaitForChild("LanternGUI")
local RValue = LanternGUI.OptionsFrame.R.Text
local GValue = LanternGUI.OptionsFrame.G.Text
local BValue = LanternGUI.OptionsFrame.B.Text
local SubmitButton = LanternGUI.OptionsFrame.ChangeColorButton
-- Animations -- (might add, not sure.)
-- Core Script --
script.Parent.Equipped:Connect(function()
LanternGUI.Enabled = true
end)
script.Parent.Unequipped:Connect(function()
LanternGUI.Enabled = false
end)
SubmitButton.MouseButton1Click:Connect(function(Player)
Portal:FireServer(Player, RValue, GValue, BValue)
end)
Little more complicated, but still fairly short.
I know this might be something super easy I’m missing, I just have a feeling the RGB values I made with the variables might be wonky, or are not supported by Color3.fromRBG(). Same happened with Color3.new() btw.