I am trying to make a system where you can buy a ticket from multiple ticket machine around the map but for some reason the code won’t repeat more than once. I assume it is due to it firing twice on the second time round but i cant understand why it does that.
Any help will be appreciated. If you need any more info just ask!
Thank You

Maybe it’s about clickDetector.MaxActivationDistance, you set this value to 0, after which this value does not change. After debounce = false, try writing clickDetector.MaxActivationDistance = (desired distance)
Ok ill try that in a second. Thanks!
Couple things I have to say:
In the first and second image:
You do not have to have parentheses inside the of the brackets. In this example, you can simply write:
game.Players[player.Name].PlayerGui.TicketSystem.TicketMachineScreen.Value = script.Parent
In the second image:
You do not have to add a “player” parameter with FireServer, because when using that function, it automatically sends the client (player) as the first parameter. This would also be alright:
Shrimpton:FireServer()
Those are just a couple of things that’d make the script a little simpler easier to read.
Also, in this line . . .
game.Players[(player)].Backpack:WaitForChild("Shrimpton Ticket")
is the variable player defined as the player object or the player’s name? That can cause issues.
If the variable is defined as the player object then you do not need the game.Players in front of it, however, if it is set as the name of the player, then you do.
I saw the video, and the output was posting “Custom_Name is not a valid member of Model”. Maybe that may be causing the issue? Make sure you do not have any typos or anything.
These may be some of the things that could be causing issues on top of what @MrZbou said.
The Custom_Name was for an NPC we were using for scaling. Thanks for the help though!
It doesn’t work still. The code still outputs twice. I dont know why. In the output it prints the name NaweRBLX twice instead of once indicating the script does it twice. I cant understand why. Maybe if that was fixed that could make it work?
Then try to make it easier, replace:
while true do
wait()
if debounce == false then
debounce = true
on
clickDetector.MouseClick:Connect(function()
if debounce == false then
debounce = true
then remove the “function OnMouseClick” and the attached “end”
If it doesn’t work, then could you please provide me the model itself, could I figure it out and say what’s wrong?
Yes that works perfectly thank you, only sends once now but the ScreenGui still doesn’t come up and i cant work out why. I was looking and the Adornee stays nil which makes it seem like the script isnt sending the request to change it even though the script is working.
Unfortunately, I cannot fully understand your entire ticket system, could you provide me a model or baseplate with this model?
I think you could try doing After debounce = false and might try to write in there clickDetector.MaxActivationDistance = (desired distance) Like MrZbou said.
Added to TC. Thank you for your help anyways, much appreciated.
Ill add you to a tc so then you can look at the code and stuff?