Why doesn't the script listen to the code I wrote?

So look,

I made a tool where you equip it it will show your information n stuff, (Your name, userid and your head shot photo)

afbeelding

I use values in-case somebody steals somebody else’s permit so police can check if the permit is legit from the person,

However, if I drop the tool on the ground on somebody else picks it up the script doesn’t listen to the code I wrote.

afbeelding

Because I made a script if you’re in a certain group it will give you a permit tool and assigns your name and user id on a string value.

afbeelding

As I said before, once another person picks up the tool, the script will just put the PLAYER’s USERNAME AND USER ID while i told it to put the string values value inside of it.

Please help me with this, i’m legit struggling with this for hours.

You need to update the code when someone equips it you can do this using run service

Explain in detail sir, I don’t really know what you mean.

You would need to check that the new person who picked it up matches the old person and if they don’t then it won’t change

I don’t know much lua or the rest of your script so I can’t really say anything else :grimacing:

It already loops it on this way, I don’t now if you mean by this.

Well that doesn’t solve the problem if it’s on the loop here.

As I said before that there are 2 values (Username and UserId) every 1 second it does the same thing but for some reason the script doesn’t want to listen to my code which meants to put the user id inside the string value.

I’m not sure this is possible but maybe make the script delete itself after everything gets set

Oh boy, this is surely possible, there is just something blocking my way putting the values inside the textlabels.

You could just disable the script instead of deleting it.

What do you mean by that sir?
What script.

@bogotesr was saying to destroy the script I believe that is having the problem but instead you could just disable the script.

The issue is that you’re not updating the values after it is equipped by another player. No, do not reply to this and tell me you have a while loop. All that’s doing is setting the text of the frame to the first value it ever found because you never change the value.

The value doesn’t change, nothing is changing the value, even if it’s on the workspace dropped on the floor or equipped by a player. it still shows they’re information outta nowhere, i tried on different baseplate, but same thing.

Are you changing the values from the client?

The values don’t change, the values are done by server.

if player is in a group it puts their user name and user id in the values and gives them the tool in backpack, but if someone else equips it, the value doesn’t change but the name changes on text???

Can we see the entirety of both scripts?

Gives tool:

Info:

Ok, does the output show any errors or warnings? Also, for the line that updates the picture, it won’t get the new picture because it’s using the old userid value and not the new one.

Also, Can I see what the player variable is?

Also, you should be copy and pasting the code instead of screenshotting it

No errors, It’s SUPPOSED to use the old one, because everytime the player gets a permit it’s assigned to it’s original owner, i don’t want it to change i want it to stay on original owner info, that’s why i made values.

I kinda fixed it by now, just some few bugs i’ll fix soon