Why is my code only working the first time?

I have a Local Script inside of a Button with this code in:


There is then a script inside a part in the workspace which receives the prompt.

	local Person = Player.Name
	local FolderToLook = script.Parent.Parent.Parent.Claimed:GetChildren()
	for i,v in pairs(FolderToLook) do
		if v:IsA("StringValue") and v.Name == Person then

The problem is that this code will only work once, I click the button to end my Job the first time and it works fine, if I then quit my job a second time and it doesn’t do anything. Are there any solutions to this problem?

You’re not changing any values that would make this stop working a second time in the code above so I would assume it has something to do with the value you are looking for not being there a second time or something along the lines of that or something we can’t see here, check if the value is in the folder the second time with your “person’s name” and also print something where the button is clicked to make sure that your button is actually being clicked a second time.

Thanks for the information, I’ll have a look now if i’ve missed anything!