Hi, i have a button that when the player presses it, it changes the material of meshparts in their character with the tag bodypart, i’m using a local script, a remote event and a server script however it only works on the client, so the other players cannot see it, here is the local script:
local button = script.Parent
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local changeEvent = ReplicatedStorage:WaitForChild("ChangeBodyPartsEvent")
button.MouseButton1Click:Connect(function()
changeEvent:FireServer()
end)
and here is the server script:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local CollectionService = game:GetService("CollectionService")
local changeEvent = ReplicatedStorage:WaitForChild("ChangeBodyPartsEvent")
changeEvent.OnServerEvent:Connect(function(player)
local character = player.Character
if character then
local taggedParts = CollectionService:GetTagged("bodypart")
for _, part in ipairs(taggedParts) do
if part:IsDescendantOf(character) and part:IsA("MeshPart") then
part.Material = Enum.Material.SmoothPlastic
part.Transparency = 0
part.Reflectance = 0.25
end
end
end
end)
The local script is inserted in a button, the remote event is in replicated storage, the server script is in server script service, i am using a cusom character.
I have no idea what the issue is and i’m a little confused, it works only for the client.