Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Changing the color of an accessory, visible for everyone?

Asked by 5 years ago
Edited 5 years ago

I have this script that will, on the click of an ImageButton, change the color of an accessory they're wearing into white. Although the color change will only be available for the player and not anyone else. How could I make it so everyone can see that the accessory has turned white?

local variable = script.Parent
local p = game:GetService("Players").LocalPlayer

variable.MouseButton1Click:Connect(function()
    if p.Character then
        for _,v in next,p.Character:GetChildren() do
            if v.Name == "Accessory" then
                v.Part.Mesh.VertexColor = Vector3.new(1, 1, 1)
            end
        end
    end
end)

1 answer

Log in to vote
0
Answered by
aazkao 787 Moderation Voter
5 years ago

That is because you only changed it client-side, so the property is changed only on your computer.

You will have to learn how to use remoteevents, basically mousebutton1click code will be inside a localscript, and when the action is performed, it will trigger a RemoteEvent that will trigger a script, inside that script is where you change the accessory, as scripts work server-side,so all the clients can see it

https://www.robloxdev.com/api-reference/class/RemoteEvent

0
Damn.. okay thank you! felonymartinez 12 — 5y
0
Good luck, if you have any questions you can always come back here and ask, and thanks for accepting the answer aazkao 787 — 5y
Ad

Answer this question