normal script in workspace.
local remote = Instance.new('RemoteFunction', game:GetService('ReplicatedStorage'));
remote.Name = 'Utility';
local part = workspace.Part;
remote.OnServerInvoke = function(player, command, ...) --// ... used here makes this a variadic function. Link to an explanation is at the bottom of this answer.
local args = {...} --// Turn the extra arguments into a table.
if command == 'colour' then
elseif command == 'light' then
local colour = args[1]
part.PointLight.Color = ColorSequence.new(colour)
if type(colour) == 'string' then
part.BrickColor = BrickColor.new(colour); --// Ideally, you'd check if it's a valid colour with a table. Skipping this for the example.
end;
end;
end;
local script in startergui.
script.Parent.MouseButton1Click:connect(function()
local remote = game:GetService('ReplicatedStorage'):WaitForChild('Utility');
remote:InvokeServer('colour', '255,0,0');
end)
i want to change a pointlight color in workspace when a gui is clicked. since i didnt want to use alot of remote events for each color @Pyrondon came up an easier way for me to do it with brick's but i just want to know how would i use this for pointlights? i apologize @Pyrondon i am not a great scripter so i dont know if this is what you meant. Any help appreciated as all ways. Thank you. @Pyrondon 's script for bricks. https://scriptinghelpers.org/questions/35473/how-can-i-use-1-remote-eventfunction-for-multiple-things
