Hello! I’m currently trying to turn all players which aren’t the LocalPlayer another color. To achieve this I made a Local and a Server script.
On Server
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local enemyCreate = ReplicatedStorage:WaitForChild("EnemyEvent")
local function PlayerAdded(plr)
for i, onPlayer in ipairs(Players:GetChildren()) do
print(tostring(onPlayer))
enemyCreate:FireClient(plr, onPlayer)
print("Fired Enemy creation")
end
end
Players.PlayerAdded:Connect(PlayerAdded)
Local
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local enemyCreate = ReplicatedStorage:WaitForChild("EnemyEvent")
enemyCreate.OnClientEvent:Connect(function (onPlayer)
local player = game:GetService("Players")
print(onPlayer)
if onPlayer ~= player.LocalPlayer then
workspace:WaitForChild(tostring(onPlayer))["Body Colors"].HeadColor3 = Color3.new(0, 0, 0)
workspace:WaitForChild(tostring(onPlayer))["Body Colors"].LeftArmColor3 = Color3.new(0, 0, 0)
workspace:WaitForChild(tostring(onPlayer))["Body Colors"].LeftLegColor3 = Color3.new(0, 0, 0)
workspace:WaitForChild(tostring(onPlayer))["Body Colors"].RightArmColor3 = Color3.new(0, 0, 0)
workspace:WaitForChild(tostring(onPlayer))["Body Colors"].RightLegColor3 = Color3.new(0, 0, 0)
workspace:WaitForChild(tostring(onPlayer))["Body Colors"].TorsoColor3 = Color3.new(0, 0, 0)
end
end)
The issue I’m having is this: while testing with clones of myself in studio, Player1 sees nobody as the new color, Player2 sees only 1 with changed color, Player3 only 1 and 2, and so on… while everybody should see everyone except themselves with a different color.
It’ll be really helpful is someone could point out what I’m doing wrong!