Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Why Isn't the button not responding even If you press It?

Asked by 2 years ago

Ello Developers!

As the title says, for some reason, my button doesn't do anything, even if you press It, basically, If you equip the Item, It will show the GUI buttons, I want my game to be mobile friendly, so that way mobile players can access special abilities which otherwise can only be accessed by PC users via pressing a button like "E"

Script:

local tool = script.Parent
local Debounce = false
local Ability1Debounce = false
local Player = game:GetService("Players").LocalPlayer

tool.Equipped:Connect(function()
    Player.PlayerGui.GUIButtons.Enabled = true
    tool.Unequipped:Connect(function()
        Player.PlayerGui.GUIButtons.Enabled = false
    end)
end)

tool.Activated:Connect(function()
    if not Debounce and tool.Parent.Humanoid.PlatformStand == false then
        Debounce = true
        tool.RemoteEvent:FireServer()
        wait(0.5)
        Debounce = false
    end
end)

--Ability1--

game:GetService("UserInputService").InputBegan:Connect(function(input, gameProcessedEvent)
    if input.UserInputType == Enum.UserInputType.Keyboard then
        if input.KeyCode == Enum.KeyCode.E and Ability1Debounce == false then
            Ability1Debounce =  true
            tool.FirePipe:FireServer()
            wait(0.10)
            Ability1Debounce = false
        end
    end
end)

Player.PlayerGui.GUIButtons:WaitForChild("E").Activated:Connect(function()
    if not Ability1Debounce then
        Ability1Debounce =  true
        tool.FirePipe:FireServer()
        wait(0.10)
        Ability1Debounce = false
    end
end)
0
Activated does not support all inputs i'm pretty sure. Try GUIButtons:WaitForChild("E").TouchTap or GUIButtons:WaitForChild("E").MouseButton1Click. MouseButton1Click works on mobile for me but if it doesn't work then use touchtap. I hope this helps. theegggod142 35 — 2y
0
It sadly doesn't work... Oof imnotaguest1121 362 — 2y

Answer this question