How would I prevent this warning?

This is not an error. All relevant code shown. Please comment if you can help.

3 Likes

I can help.
Can you provide me the entire script code when the warn happened?

I said this is all the relevant code. Just trust me.

Explain to me what is this script about?

It doesn’t matter. If you are a good scripter you’d see what it’s doing

it may happen because the script can’t find the player’s character (not sure since i see that warning for the first time)

also it’s better to show full script

Why should I show people the rest? To confuse people and make them read unnecessary code? I’m telling you now that this is the only relevant part of the script
If it wouldn’t find the players character it would error.
It goes on the character fine anyway

Who knows what can cause a problem when you show only the rest of your script, there can be many things breaking your code

The only time I’ve seen that warning come up is when you create something on the server and the client tries to instantly destroy it as soon as it replicates to them. Maybe one of your LocalScripts is doing something like that?

There is nothing in the code that you have shown that would produce a warning like that. It may be possible that you have a race condition where another script is trying to access the same object property as the script that you posted. If a property is being accessed and another script comes in to try to access the same property while that property is locked by the first script, you could see a warning like that.

Check everywhere that object is being accessed. Maybe add a few print statements. Does this happen every time? Sometimes? Rarely?

1 Like
RandomCharacter:Destroy()
print("1")
local Script = ServerStorage.Objects.NPC.Randomise:Clone()
print("2")
Script.Parent = Plr.Character
-- warning occurs here
print("3")

Every time. Fyi “RandomCharacter” replaces the players character, see the code in the post. No other script interferes.

You haven’t seen this warning before so I don’t want you to help, need someone with this experience
I can tell you that you are wrong anyway

Possible that the error is delayed - does it still occur when you remove

RandomCharacter:Destroy()

?

Still happens charactersssssssssssssss

Don’t think it is the case, but did the print statements twice? It is possible that the function was called twice in a very very short amount of time

if Roles.Anonymous:FindFirstChild(AlonePlayer.Name) then
	MakeCharacterAnonymous(AlonePlayer)
end

Calls it once, not in a loop, and prints once

Oh I just realised why. You are setting the RandomCharacter variable but destroy it without any delays
Line 89, then line 100

That’s rude. They asked a question about your code so they know what it does. They want to help you.

1 Like

Why line 89?
I’ll try 100 I can see why