How would I prevent this warning?

I am having manners with people who are helping, not those who aren’t. Leave, you are not helping

Alright, but this function seems to be dedicated to specifically when they are going to be anonymous. Looks like the same thing.
Maybe try using a modulescript of some kind.

What do you mean by this?

And how would a module script solve it? I can still see it happening

No, you’re just being rude. For all that matters, you’re calling people inexperienced, but your script is full of bad practices (wrong naming conventions, accessing services by indexing, using deprecated methods, should I go on?). Your definition of “not helping” is them asking questions related to your code. Telling people to “leave, you’re not helping” is just shooting yourself in the foot. Good luck with your code!

1 Like

Stop stirring and leave. As I said, leave if you’re not going to help buddy

You’re literally being rude yourself :joy:
Firstly, I’d love to know specific practises that wrong - what I am trying to achieve is very specific. And I can tell if someone doesn’t know what they’re doing. My description of the post could have saved him time, clearly stated “comment if you can help” not “comment if you can help and learn”. Basically I need someone who knows how to fix it!

Your function is called “MakeCharacterAnonymous”. If you are using the “randomise” script only to change their appearance specifically for that function, just make it a part of it. I don’t know your reasons, so theres not much I can understand from what you’re saying.

If you need to use it in more than 1 script (since you are cloning it, not sure why) you could use use it as a modulescript function.

Call me whatever you want. By the way, your refusal to show code is not helping you. According to your variable name, Randomise is a script, but you’ve been refusing to show its contents for the past 50 replies, when the error could very well be from there.

1 Like

could you show what is in the randomizer script? There could be an error in it. (Something causing the warning)

I’m cloning it because that character is an actual NPC used in the game not just for changing appearance.

The randomise script was already used by the NPC too, so I thought I’d be efficient and save code

Past 50 replies? No one has asked for anything else except that one dude who didn’t know what he was doing.

You don’t have evidence to show that me not providing it doesn’t help. I know for a fact it won’t.

Okay, have fun debugging your code yourself then, since the error is not caused by what you’ve shown, and we can’t help you if you’re not showing us your code.

1 Like

The randomise script changes the skin colour + face decal + doesn’t show a warning when it is used by NPC’s who have this script parented in themselves

If the randomise script destroys itself, you’re doing it in the same frame as it is cloned, and the engine has an issue with that.

1 Like

Great. We know what that does now, at least.
You might just want to use that as a regular function. Put all npcs that use this in a folder, give them an attribute of “needtoberandomized” or something, and run a loop through the folder so it looks for everyone that needs it. No need to put a script in every each and one of them.

No no no, I don’t have many of them, I clone many of them
But that’s not related, I’m using the script within this NPC to clone to players rather than using the code within again in another script

Where in the code you sent is the function MakeCharacterAnonymous() being called?

Is the script client or server ?

There we go. That was the problem.

And before asking me why I didn’t show the script, to be fair, no one asked what was within the script except one of the last comments where I actually gave him details, however I should have stated it destroyed itself.

1 Like

Thanks for helping anyways characterssss

Hmm… If you are changing the player’s character model, try setting the new model parent to Player, then set Player.Character to the new model. You are making an anonymous/generic character.

It’s also saying that something is trying to set the Parent of Randomize to NULL, not nil. NULL is a C term. On most systems, it’s defined as 0x00000000 (or 0x0000000000000000 for 64-bit systems). I don’t think that the problem is in your script. It’s something lower level in the C code that executes the LUA script.

I still think this is a race condition. Someone here suggested checking the client script to see if Randomize is being destroyed immediately after duplication. Beyond that, this could be an engine bug that you script is somehow triggering. At any point are you destroying the Randomize script? That would set and lock it’s parent to nil.

EDIT And reading the rest of what everyone else said (after I posted this), I see you found the problem.

Cheers.