Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
0

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

Asked by 9 days ago
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)
0
If you guys are still confuse i'll be in the chat JerkDerekThe14alt 9 — 9d
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 ! Tizzel40 225 — 9d
0
Yeah I was going to add my explanation, JerkDerekThe14alt 9 — 9d
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 JerkDerekThe14alt 9 — 9d
0
I basically want the client to see the colors change as well thanks! JerkDerekThe14alt 9 — 9d

1 answer

Log in to vote
0
Answered by 9 days ago

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

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

0
Specifically in what script should I put this at? JerkDerekThe14alt 9 — 9d
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. radiant_Light203 345 — 9d
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(). radiant_Light203 345 — 9d
Ad

Answer this question