I have been making an ‘E to enter car’ GUI and to make it accessible to mobile I turned the text into textButtons, put the GUI in StarterGui, set the adornee to the part, and added to my carEnter Local script a touchTap event on the textButtons in the PlayerGui, but it won’t trigger in the mobile emulation!
Here’s a screenShot of what’s happening:
there are also no errors.
here is my code:
local enter = game.Workspace:WaitForChild("Humvee"):WaitForChild("Enter")
local HumRoot = script.Parent:WaitForChild("HumanoidRootPart")
local CAS = game:GetService("ContextActionService")
local UIS = game:GetService("UserInputService")
debounce = false
working = false
local function exitCar()
print("Exit")
CAS:UnbindAction("ExitCar")
end
local function enterCar()
if debounce == false then
debounce = true
game:GetService("ReplicatedStorage").EnterCar:FireServer(enter.Parent.Body.HumveeSeat)
CAS:BindAction("ExitCar", exitCar, false, "Shift", Enum.KeyCode.LeftShift, Enum.KeyCode.RightShift)
game.Players.LocalPlayer.PlayerGui.ExitCarGui.Enabled = true
--print("yo, it worked!")
wait()
debounce = false
end
end
local Gui = game.Players.LocalPlayer.PlayerGui.Gui
if UIS.TouchEnabled then
print("touch")
game.Players.LocalPlayer.PlayerGui:WaitForChild("ExitCarGui"):WaitForChild("TextButton").Text = "Tap to exit car"
--enter:WaitForChild("Gui").Value:WaitForChild("Enter").Text = "Tap"
--enter.Gui.Value.Enter.TouchTap:Connect(enterCar)
--enter.Gui.Value.desc.TouchTap:Connect(enterCar)
Gui.Enter.Text = "Tap"
end
Gui.Enter.TouchTap:Connect(enterCar)
Gui.desc.TouchTap:Connect(enterCar)
game.Players.LocalPlayer.PlayerGui:WaitForChild("ExitCarGui"):WaitForChild("TextButton").TouchTap:Connect(exitCar)
while true do
local _,isPartOnScreen = workspace.CurrentCamera:WorldToScreenPoint(enter.Position)
if not script.Parent:WaitForChild("Humanoid").Sit and (HumRoot.Position - enter.Position).Magnitude <= 10 and isPartOnScreen then
if working ~= true then
enter.Gui.Value.Enabled = true
working = true
CAS:BindAction("Interacted", enterCar, false, "e")
--CAS:SetImage("Interacted", "rbxassetid://4205263")
end
else
if working ~= false then
working = false
enter.Gui.Value.Enabled = false
pcall(function()
CAS:UnbindAction("Interacted")
end)
end
end
wait()
end
By the way, pressing E to enter the car does work.
Finally, here’s a picture of the explorer: