#so i tried to make mobile controls for m1's but it doesn't work now

1 messages · Page 1 of 1 (latest)

granite ice
#
local RS=game:GetService("ReplicatedStorage")
local UIS=game:GetService("UserInputService")
local Remotes=RS:WaitForChild("Remotes")
local M1AttackRemote=Remotes:WaitForChild("M1Attack")

local HoldingDownM1=false

UIS.InputBegan:Connect(function(input, GPE)
    if input.UserInputType~=Enum.UserInputType.MouseButton1 or input.UserInputType~=Enum.UserInputType.Touch then return end

    HoldingDownM1=true

    task.spawn(function()
        while HoldingDownM1 do
            task.wait()
            M1AttackRemote:FireServer()
            print("FDafdasfdafdsa")
        end
    end)
end)

UIS.InputEnded:Connect(function(input)
    if input.UserInputType==Enum.UserInputType.MouseButton1 or input.UserInputType==Enum.UserInputType.Touch then
        HoldingDownM1=false
    end
end)```