So i am making a Debug for my game so i can easily test things, I have a simple GUI with a button to add food, here is the script:
1 | script.Parent.MouseButton 1 Click:connect( function () |
2 | game.ReplicatedStorage.Debug_Events.AddFood:FireServer() |
3 | print ( "Client - Debug: " , script.Parent.Parent.Name, " - Fired" ) |
When clicking the button it should fire the server so that my server script can pick it up and change a value, Here is the script that picks it up:
2 | local Event = game.ReplicatedStorage.Debug_Events |
3 | Event.AddFood.OnServerEvent:Connect( function () |
4 | workspace.Player_Cache.Food.Value = workspace.Player_Cache.Food.Value + 1 |
5 | print ( "Client - Debug was used to add Food" ) |
All i want is for it to fire once and add 1 food to the current amount of food, Instead it fires anywhere from 50 - 900 times, I added a Debounce on both and it still did the same, any help is much appreciated.