Hi, I made a GUI that simply activates an ability if you either press the button or press the key corresponding to it.
The keyboard key function works however the GUI button click function doesnt fire the remote event. Why is that?
I tried switching it out with MouseButton1Click but that didn’t work either.
LocalScript in the GUI button:
local Button = script.Parent
local Players = game:GetService("Players")
local UIS = game:GetService("UserInputService")
local Player = Players.LocalPlayer
local Remote = Button:WaitForChild("RemoteEvent")
local Ready = true
Button.Activated:Connect(function()
if Ready == true then
print("Pressed!")
Ready = false
Remote:FireServer()
task.wait(8)
Ready = true
end
end)
UIS.InputBegan:Connect(function(input,gameProcessed)
if input.KeyCode == Enum.KeyCode.Q and gameProcessed == false and Ready == true then
print("Pressed!")
Ready = false
Remote:FireServer()
task.wait(8)
Ready = true
end
end)