I have a vehicle system for mobile and I need the textButtons to work properly.
Here is my primary goal: When mouseEnter and mouseDown on the textbutton, then the code runs, and when mouse is on the textbutton but the mouse isn’t holding, then the code doesn’t run.
I already have it working by using mouseEnter, but when the mobile player taps on it, then the code keeps running since the mouse is technically still on the textbutton. I don’t know how to achieve this so I need help.
for i, v in movementFrame:GetChildren() do
if v:IsA("TextButton") then
v.MouseEnter:Connect(function()
if v.Name == "UpButton" then
print("Up")
end
if v.Name == "DownButton" then
print("Down")
end
if v.Name == "LeftButton" then
print("Left")
end
if v.Name == "RightButton" then
print("Right")
end
end)
end
end
for i, v in movementFrame:GetChildren() do
if v:IsA("TextButton") then
v.MouseEnter:Connect(function()
while isHolding do
RunService.Heartbeat:Wait()
if v.Name == "UpButton" then
print("Up")
end
if v.Name == "DownButton" then
print("Down")
end
if v.Name == "LeftButton" then
print("Left")
end
if v.Name == "RightButton" then
print("Right")
end
end
end)
end
end
How would I use context action service. The reason why im not using the mobile ui is because it’s really hard to control the vehicle so that’s why I’m making the controls custom using gui.
I tried to implement it but its basically the same thing using a vehicle seat but easier. Besides that, it also only works on the local script so It’s harder to get it started. That’s also a reason why I want to use GUI.
I forgot to mention this but the main reason why I’m using gui for mobile is because the vehicle always turns left or right even if you’re joystick is pointing forward. The movement is more precise on pc so it works perfectly fine there.