The title may seem confusing, but what I am asking is why my input on other buttons disappears when I press another button!
For example, in my case:
I have this fully scripted mobile support type of system for my game. Everything works, but if I press one of the go left or go right buttons and, at the same time, I press the jump button. It makes my character jump and stops it from moving in those selected directions.
Here are my scripts:
For the jumpButton:
local parent = script.Parent
local player = game:GetService(“Players”).LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local hum = char:WaitForChild(“Humanoid”)
local isHeld = false
parent.MouseButton1Down:Connect(function()
isHeld = true
while isHeld and hum.FloorMaterial ~= Enum.Material.Air do
hum:ChangeState(Enum.HumanoidStateType.Jumping)
wait(0.2)
end
end)
parent.MouseButton1Up:Connect(function()
isHeld = false
end)
The left and right buttons are connected to multiple scripts, thus making it hard for me to share, so I will just explain how it works. When the local script detects any input in those buttons, it creates a part slightly offset in the direction of the player relative to the pressed button, and uses the roblox :MoveTo() to make the player move to that part, and it keeps updating the part offset and makes the player move to it until the imput is released.
If anyone knows how I could fix this problem, please tell me. I have tried multiple things but nothing worked out, so I came here!
DISCLAMER: I have posted this as a developer discussion because this might have already been a problem, and I don’t think my scripts should stop the input of other scripts that are completely unrelated.