Hi, I’m trying to make a script that will detect when the player has jumped and closed a GUI and it doesn’t work yet I don’t know why. I was wondering if I could please have some help with identifying the issue.
local UserInputService = game:GetService("UserInputService")
function onJumpRequest()
print("detected")
local frame = script.Parent
script.frame.Visible = false
print("Worked ")
end
UserInputService.JumpRequest:Connect(onJumpRequest)
repeat
wait()
until
game.Players.LocalPlayer.Character
local Character = game.Players.LocalPlayer.Character
local Gui = script.Parent
Character:WaitForChild("Humanoid"):GetPropertyChangedSignal("Jump"):Connect(function()
Gui.Enabled = false
end)
local humanoid = game.Players.LocalPlayer.Character:WaitForChild("Humanoid")
function onJumpRequest()
print("detected")
local frame = script.Parent
frame.Visible = false
print("Worked ")
end
humanoid.Jumping:Connect(onJumpRequest)