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)

2 comments

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.

0

It sadly doesn't work... Oof