Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How can I code where the client can see as well in this is a local script ?

wait(0.1)
local Player = game.Players.LocalPlayer
local Button = script.Parent.Toggle.Button
local Menu = script.Parent.Menu
local Debounce = false

function ChangeColor(Child, Code)
	if Code == 1 then
		Child.BrickColor = BrickColor.new(Color3.fromRGB(255, 255, 255))
	elseif Code == 2 then
		Child.BrickColor = BrickColor.new(Color3.fromRGB(255, 0, 0))
	elseif Code == 3 then
		Child.BrickColor = BrickColor.new(Color3.fromRGB(0, 0, 255))
	elseif Code == 4 then
		Child.BrickColor = BrickColor.new(Color3.fromRGB(0, 255, 0))
	elseif Code == 5 then
		Child.BrickColor = BrickColor.new(Color3.fromRGB(255, 255, 0))
	elseif Code == 6 then
		Child.BrickColor = BrickColor.new(Color3.fromRGB(0, 255, 255))
	elseif Code == 7 then
		Child.BrickColor = BrickColor.new(Color3.fromRGB(255, 0, 255))
	end
end

function Recurse(Child, Action, Code)
	for i, Object in ipairs(Child:GetChildren())do
		if Object:IsA('BasePart') and Object.Parent.Name == 'NeonLights' then
			if Action == 2 then
				ChangeColor(Object, Code)
			end
		end
		Recurse(Object, Action, Code)
	end
end



Menu.White.MouseButton1Click:connect(function()
	Recurse(game.Workspace, 2, 1)
	ChangeMenuColors(Color3.fromRGB(255, 255, 255))
end)

Menu.Red.MouseButton1Click:connect(function()
	Recurse(game.Workspace, 2, 2)
	ChangeMenuColors(Color3.fromRGB(255, 0, 0))
end)

Menu.Blue.MouseButton1Click:connect(function()
	Recurse(game.Workspace, 2, 3)
	ChangeMenuColors(Color3.fromRGB(0, 0, 255))
end)

Menu.Green.MouseButton1Click:connect(function()
	Recurse(game.Workspace, 2, 4)
	ChangeMenuColors(Color3.fromRGB(0, 255, 0))
end)

Menu.Yellow.MouseButton1Click:connect(function()
	Recurse(game.Workspace, 2, 5)
	ChangeMenuColors(Color3.fromRGB(255, 255, 0))
end)

Menu.Cyan.MouseButton1Click:connect(function()
	Recurse(game.Workspace, 2, 6)
	ChangeMenuColors(Color3.fromRGB(0, 255, 255))
end)

Menu.Pink.MouseButton1Click:connect(function()
	Recurse(game.Workspace, 2, 7)
	ChangeMenuColors(Color3.fromRGB(255, 0, 255))
end)

Button.MouseButton1Click:connect(function()
	if Menu.Visible == false and Debounce == false then
		Debounce = true
		Menu.Visible = true
		Menu:TweenPosition(UDim2.new(0.11, 0, 0.6, -13), 'Out', 'Quad', 0.2, true)
		wait(0.2)
		Button.Text = 'Close Neon Menu'



		Debounce = false
	elseif Menu.Visible == true and Debounce == false then
		Debounce = true
		Menu:TweenPosition(UDim2.new(0, -200, 0.6, -13), 'Out', 'Quad', 0.2, true)
		wait(0.2)
		Button.Text = 'Open Neon Menu'
		Menu.Visible = false
		Debounce = false
	end
end)

5 comments

0

If you guys are still confuse i'll be in the chat

0

Can you please add an explanation to your question and code? don't just write a question and just slap a piece of code with it with no explanation !

0

Yeah I was going to add my explanation,

0

JerkDerekThe14alt 9 I basically have a script which is the parent https://pastebin.com/DqP4tu51 inside of the parent I have a local script which is the one I posted, the problem is only the "owners" of the main script are able to see the color change but not the client meaning people who aren't the owners but in the game And this is a script that was given to me in 2015 so I guess it's outdated

0

I basically want the client to see the colors change as well thanks!

1 answer

Send a server event that invokes all clients and makes those changes.

https://developer.roblox.com/en-us/articles/Remote-Functions-and-Events

3 comments

0

Specifically in what script should I put this at?

0

Send a server event every time something is updated. The server stores this change and fires the event to every client which also makes these changes. It doesn't go in a script, but functions are created in scripts to reference remote events.

0

Remote events are objects you put in the game they don't do anything by themselves and are triggered/called by referencing it and either :Fire server() or .OnServerEvent:Connect().

This discussion is preserved as it was. New answers, comments, and votes are closed.