It is supposed to enable a ScreenGui when a ClickDetector gets clicked, and then disable it if Humanoid.Running is fired.
Testing the game, it gave me these results:
When you spawn first, it works fine, but after the player dies, if you try again, the section of the script that disables the Gui is completely ignored, and the “b” doesn’t print.
What do I want?
I want to know why this happens and how I can fix it.
The Humanoid.Running will keep firing when the player walks, even after the GUI is disabled. I want to know if this affects performance and if so, I’d like to know how can I counter this so that it doesn’t lag the client.
Since you’re open to pointing out bad practices, I’d like to mention that you should use Humanoid.Running:Once() instead of Humanoid.Running:Connect(), as otherwise you’re creating permanent connections every time you open the backpack.
Not sure what you mean by that, I just get the humanoid trough this:
local player = game:GetService("Players").LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local Humanoid = character:FindFirstChildOfClass("Humanoid")
This worked. However, do you guys have any tips on the second point of my post?
The Humanoid.Running will keep firing when the player walks, even after the GUI is disabled. I want to know if this affects performance and if so, I’d like to know how can I counter this so that it doesn’t lag the client.