#Error: character cannot be changed as Player (Player name) is being removed
30 messages · Page 1 of 1 (latest)
Send me the code where the error is occuring
local players = game:GetService("Players")
local Player = players.LocalPlayer or players.PlayerAdded:Wait()
game:GetService("RunService").RenderStepped:Connect(function()
for _, v in pairs(players:GetPlayers()) do
if v.Character and v ~= game.Players.LocalPlayer then
local char = v.Character or v.CharacterAppearanceLoaded:Wait()
if char then
for _, v in pairs(char:GetChildren()) do
if v:IsA("MeshPart") or v:IsA("BasePart") then
v.Transparency = 1
end
if v:IsA("Decal") then
v.Transparency = 1
end
end
end
end
end
end)
the code is kind of a mess because ive been messing with it trying to come up with any sort of solution
I think its because you're using the same variable "v" twice for player:GetPlayers() and char:GetChildren()
The game doesnt know if your v variable is referring to the player or the actual player character @mint ginkgo
The thing is thought it works for already existing players
basically new player joins it breaks for old player but works for new player
I'll try changing the variable
Lmk if that fixes the issue
local players = game:GetService("Players")
local Player = players.LocalPlayer or players.PlayerAdded:Wait()
game:GetService("RunService").RenderStepped:Connect(function()
for _, v in pairs(players:GetPlayers()) do
if v.Character and v ~= game.Players.LocalPlayer then
local char = v.Character or v.CharacterAppearanceLoaded:Wait()
if char then
for _, y in pairs(char:GetChildren()) do
if y:IsA("MeshPart") or y:IsA("BasePart") then
y.Transparency = 1
end
if y:IsA("Decal") then
y.Transparency = 1
end
end
end
end
end
end)
dont worry about the noob look thats just something having to do with roblox character override being weird
I managed to pump out of a solution that avoided the error
How
alr figured you were going to guess or ask but you havent SO bottom line all players share humanoid,HRP, and depending on game settings, Torso, UpperTorso etc etc. Instead of going through the players in players and then searching for them in workspace you just search for any model with a humanoid in workspace and if the model name ~= localplayer then you do the transparency stuff
Sure this applies to any humanoid character BUT quick fix to that is looking for v.name rather than v:IsA and renaming all npc humanoids to npc or monster or whatever
I think the main issue though was with client to server replication. All of the player character models are being updated constantly and you're constantly looking through the players when they might not be completely replicated
There's also some other stuff behind the scenes I think that plays a role in that error
It's better to disconnect the event if you're using it only once when a specific local player joins
RenderStepped can be very costly
that is more than likely the issue
no longer using render step
Overall its going to be used for a player hider system
so I have a while var = true do thing so they can turn it on and off