I have a Local Script inside of a Button with this code in:
script.Parent.MouseButton1Click:Connect(function(Player)
game.ReplicatedStorage.NPC.QuitJob:FireServer(Player)
end)
There is then a script inside a part in the workspace which receives the prompt.
game.ReplicatedStorage.NPC.QuitJob.OnServerEvent:Connect(function(Player)
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
print("Working")
end
end
end
end
end)
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?