Okay, I just decided that there wasn’t a really good way to approach this, so I made a button manager that would toggle boolean values based on whether that mutton was pressed or let go.
local RunService = game:GetService("RunService")
local Heartbeat = RunService.Heartbeat
local UIS = game:GetService("UserInputService")
local GuiService = game:GetService("GuiService")
local ControllerR = script.Parent.Effect.ControllerR
local ControllerL = script.Parent.Effect.ControllerL
local mobileBloxPatterns = {
[script.Parent.Effect.ControllerR.Center] = Vector2.new(7,0),
[script.Parent.Effect.ControllerR.Up1] = Vector2.new(10,0),
[script.Parent.Effect.ControllerR.Left1] = Vector2.new(7,3),
[script.Parent.Effect.ControllerR.Down1] = Vector2.new(4,0),
[script.Parent.Effect.ControllerR.Right1] = Vector2.new(7,-3),
[script.Parent.Effect.ControllerR.Up2] = Vector2.new(10,3),
[script.Parent.Effect.ControllerR.Left2] = Vector2.new(4,3),
[script.Parent.Effect.ControllerR.Right2] = Vector2.new(10,-3),
[script.Parent.Effect.ControllerR.Down2] = Vector2.new(4,-3),
[script.Parent.Effect.ControllerR.Farther] = Vector2.new(7,-7),
[script.Parent.Effect.ControllerL.Center] = Vector2.new(7,0),
[script.Parent.Effect.ControllerL.Up1] = Vector2.new(10,0),
[script.Parent.Effect.ControllerL.Left1] = Vector2.new(7,3),
[script.Parent.Effect.ControllerL.Down1] = Vector2.new(4,0),
[script.Parent.Effect.ControllerL.Right1] = Vector2.new(7,-3),
[script.Parent.Effect.ControllerL.Up2] = Vector2.new(10,3),
[script.Parent.Effect.ControllerL.Left2] = Vector2.new(4,3),
[script.Parent.Effect.ControllerL.Right2] = Vector2.new(10,-3),
[script.Parent.Effect.ControllerL.Down2] = Vector2.new(4,-3),
[script.Parent.Effect.ControllerL.FartherQ] = Vector2.new(7,7)
}
if UIS.TouchEnabled and not UIS.KeyboardEnabled and not UIS.MouseEnabled and not UIS.GamepadEnabled and not GuiService:IsTenFootInterface() then --mobile check
ControllerR.Visible = true
ControllerL.Visible = true
script.Parent.Menu.Currency.Visible = false
script.Parent.Menu.Shop.Visible = false
script.Parent.Menu.Background.MobileExtras.Visible = true
end
for i, v in pairs(ControllerR:GetChildren()) do
if script:FindFirstChild(v.Name) == nil then
local newValue = Instance.new("BoolValue", script)
newValue.Name = v.Name
local tied = Instance.new("ObjectValue", newValue)
tied.Name = "Origin"
tied.Value = v
end
end
for i, v in pairs(ControllerL:GetChildren()) do
if script:FindFirstChild(v.Name) == nil then
local newValue = Instance.new("BoolValue", script)
newValue.Name = v.Name
local tied = Instance.new("ObjectValue", newValue)
tied.Name = "Origin"
tied.Value = v
end
end
--Right Controller Segment
ControllerR.Center.MouseButton1Down:Connect(function()script:FindFirstChild("Center").Value = true end)
ControllerR.Up1.MouseButton1Down:Connect(function()script:FindFirstChild("Up1").Value = true end)
ControllerR.Up2.MouseButton1Down:Connect(function()script:FindFirstChild("Up2").Value = true end)
ControllerR.Left1.MouseButton1Down:Connect(function()script:FindFirstChild("Left1").Value = true end)
ControllerR.Left2.MouseButton1Down:Connect(function()script:FindFirstChild("Left2").Value = true end)
ControllerR.Right1.MouseButton1Down:Connect(function()script:FindFirstChild("Right1").Value = true end)
ControllerR.Right2.MouseButton1Down:Connect(function()script:FindFirstChild("Right2").Value = true end)
ControllerR.Down1.MouseButton1Down:Connect(function()script:FindFirstChild("Down1").Value = true end)
ControllerR.Down2.MouseButton1Down:Connect(function()script:FindFirstChild("Down2").Value = true end)
ControllerR.Farther.MouseButton1Down:Connect(function()script:FindFirstChild("Farther").Value = true end)
ControllerR.Center.MouseButton1Up:Connect(function()script:FindFirstChild("Center").Value = false end)
ControllerR.Up1.MouseButton1Up:Connect(function()script:FindFirstChild("Up1").Value = false end)
ControllerR.Up2.MouseButton1Up:Connect(function()script:FindFirstChild("Up2").Value = false end)
ControllerR.Left1.MouseButton1Up:Connect(function()script:FindFirstChild("Left1").Value = false end)
ControllerR.Left2.MouseButton1Up:Connect(function()script:FindFirstChild("Left2").Value = false end)
ControllerR.Right1.MouseButton1Up:Connect(function()script:FindFirstChild("Right1").Value = false end)
ControllerR.Right2.MouseButton1Up:Connect(function()script:FindFirstChild("Right2").Value = false end)
ControllerR.Down1.MouseButton1Up:Connect(function()script:FindFirstChild("Down1").Value = false end)
ControllerR.Down2.MouseButton1Up:Connect(function()script:FindFirstChild("Down2").Value = false end)
ControllerR.Farther.MouseButton1Up:Connect(function()script:FindFirstChild("Farther").Value = false end)
--Left Controller Segment
ControllerL.Center.MouseButton1Down:Connect(function()script:FindFirstChild("Center").Value = true end)
ControllerL.Up1.MouseButton1Down:Connect(function()script:FindFirstChild("Up1").Value = true end)
ControllerL.Up2.MouseButton1Down:Connect(function()script:FindFirstChild("Up2").Value = true end)
ControllerL.Left1.MouseButton1Down:Connect(function()script:FindFirstChild("Left1").Value = true end)
ControllerL.Left2.MouseButton1Down:Connect(function()script:FindFirstChild("Left2").Value = true end)
ControllerL.Right1.MouseButton1Down:Connect(function()script:FindFirstChild("Right1").Value = true end)
ControllerL.Right2.MouseButton1Down:Connect(function()script:FindFirstChild("Right2").Value = true end)
ControllerL.Down1.MouseButton1Down:Connect(function()script:FindFirstChild("Down1").Value = true end)
ControllerL.Down2.MouseButton1Down:Connect(function()script:FindFirstChild("Down2").Value = true end)
ControllerL.FartherQ.MouseButton1Down:Connect(function()script:FindFirstChild("FartherQ").Value = true end)
ControllerL.Center.MouseButton1Up:Connect(function()script:FindFirstChild("Center").Value = false end)
ControllerL.Up1.MouseButton1Up:Connect(function()script:FindFirstChild("Up1").Value = false end)
ControllerL.Up2.MouseButton1Up:Connect(function()script:FindFirstChild("Up2").Value = false end)
ControllerL.Left1.MouseButton1Up:Connect(function()script:FindFirstChild("Left1").Value = false end)
ControllerL.Left2.MouseButton1Up:Connect(function()script:FindFirstChild("Left2").Value = false end)
ControllerL.Right1.MouseButton1Up:Connect(function()script:FindFirstChild("Right1").Value = false end)
ControllerL.Right2.MouseButton1Up:Connect(function()script:FindFirstChild("Right2").Value = false end)
ControllerL.Down1.MouseButton1Up:Connect(function()script:FindFirstChild("Down1").Value = false end)
ControllerL.Down2.MouseButton1Up:Connect(function()script:FindFirstChild("Down2").Value = false end)
ControllerL.FartherQ.MouseButton1Up:Connect(function()script:FindFirstChild("FartherQ").Value = false end)
This is very long and repetitive, but it gets the job done.