Can't set devtouchmovementmode from script? Any workarounds?

I don’t want to always force a player to use a certain movement mode, but for the UI’s sake there are specific parts of the game where I’d like to force the thumbstick controls.

When I try to set it I get this

16:03:13.876 - Insufficent permissions to set DevTouchMovementMode
16:03:13.877 - The current identity (2) cannot setDevTouchMovementMode (lacking permission 5)

So, obviously it can’t be set via a local script. I wanted to know if there are any other ways around this?

1 Like

No, this property is intended to only be modified by higher security context level LocalScripts. Server Scripts aren’t able to either.

4 Likes

Hmm. Any way to detect what player control scheme is selected then, if the setting is set to userchoice?

That’d odd, this article about DevTouchMovementMode showcases changing the movement mode via local script.

1 Like

I saw that too. Figure it must be outdated or something.

I can maybe guess why they wouldn’t want it changeable client side - Some games may rely on it being scriptable, and if a player changes it via exploit it could cause issues.

But why not server side? >:o

im experiencing the same issue

Unfortunately you can’t do anything about this (that I know of). Apologies

That’s so bad.

I’m trying to make custom buttons for my car game and I’ve used GUI buttons to get the server to control the car’s movement via remoteevents or vehicleseat properties to get it to move like throttle or steer.

Apparently if the devtouchmovementmode is userchoice it means the car will always throttle to 0 and steer to 0 if there’s no input on the thumbstick. I’ve thought of disabling devtouchmovementmode temporarily so that the control gui buttons i’ve made for my car can be used instead.

It doesn’t work! It’s awful.


repeat wait() until game.ReplicatedStorage:FindFirstChild(game.Players.LocalPlayer.UserId)
repeat wait() print("loading") until game.ReplicatedStorage:FindFirstChild("OwnedCars", true)
repeat wait() print("looking for cars")  until  #game.ReplicatedStorage:FindFirstChild("OwnedCars", true):GetChildren() > 0


local pg = game.Players.LocalPlayer.PlayerGui
local plr = game.Players.LocalPlayer

repeat wait() until plr.Character

local UserInputService = game:GetService("UserInputService")

if (UserInputService.KeyboardEnabled) then
	print("The user's device has an available keyboard! Meaning they're not mobile")
	script.Parent:Destroy()
else
	print("The user's device does not have an available keyboard! Meaning they're mobile")
	pg.LevelBoard.PlayNotify:Destroy()
	game.ReplicatedStorage.MobileStuff.PlayNotify:Clone().Parent = pg.LevelBoard
	
	for i,v in pairs(plr.Character:GetDescendants()) do
		if v:IsA("BasePart") then
			v.Touched:Connect(function(hit)
				if hit.Parent:FindFirstChild("VehicleSeat") then
					script.Parent.EnterCar.Visible = true
					repeat wait() until plr.Character.Humanoid.Sit == true or (hit.Position - plr.Character.Head.Position).Magnitude > 10
					if plr.Character.Humanoid.Sit == true then
						script.Parent.EnterCar.Text = "Leave Car"
					end
					if  (hit.Position - plr.Character.Head.Position).Magnitude > 10 then
						script.Parent.EnterCar.Visible = false
					end
					
				end
			end)
		end
	end
	
	
	
	
	
	
end

local Car = nil


script.Parent.Boost.MouseButton1Down:Connect(function()
	if Car then
		game.ReplicatedStorage.ControlCar:FireServer(Car, "ForwardOn")
		game.ReplicatedStorage.Thruster:FireServer(true, Car)
	end
end)
script.Parent.Boost.MouseButton1Up:Connect(function()
	if Car then
		game.ReplicatedStorage.ControlCar:FireServer(Car, "StopThrottle")
		game.ReplicatedStorage.Thruster:FireServer(false, Car)
	end	
end)

script.Parent.Brakes.MouseButton1Down:Connect(function()
	if Car then
		game.ReplicatedStorage.Brakes:FireServer(true, Car)
	end	
end)
script.Parent.Brakes.MouseButton1Up:Connect(function()
	if Car then
		game.ReplicatedStorage.Brakes:FireServer(false, Car)
	end	
end)

script.Parent.Left.MouseButton1Down:Connect(function()
	if Car then
		game.ReplicatedStorage.ControlCar:FireServer(Car, "Left")
	end	
end)
script.Parent.Left.MouseButton1Up:Connect(function()
	if Car then
		game.ReplicatedStorage.ControlCar:FireServer(Car, "StopSteer")
	end	
end)
script.Parent.Right.MouseButton1Down:Connect(function()
	if Car then
		game.ReplicatedStorage.ControlCar:FireServer(Car, "Right")
	end	
end)
script.Parent.Right.MouseButton1Up:Connect(function()
	if Car then
		game.ReplicatedStorage.ControlCar:FireServer(Car, "StopSteer")
	end	
end)

script.Parent.Drive.MouseButton1Down:Connect(function()
	if Car then
		print("Alright time to drive")
		game.ReplicatedStorage.ControlCar:FireServer(Car, "ForwardOn")
	end	
end)
script.Parent.Drive.MouseButton1Up:Connect(function()
	if Car then
		print("NO MORE DRIVE")
		game.ReplicatedStorage.ControlCar:FireServer(Car, "StopThrottle")
	end	
end)
script.Parent.Reverse.MouseButton1Down:Connect(function()
	if Car then
		game.ReplicatedStorage.ControlCar:FireServer(Car, "BackwardOn")
	end	
end)
script.Parent.Reverse.MouseButton1Up:Connect(function()
	if Car then
		game.ReplicatedStorage.ControlCar:FireServer(Car, "StopThrottle")
	end	
end)




plr.Character.Humanoid:GetPropertyChangedSignal("SeatPart"):Connect(function()
	local seat = plr.Character.Humanoid.SeatPart
	
	if seat then
		
		if (UserInputService.KeyboardEnabled) then
	--		print(" i hate myself ")	
		else
			UserInputService.ModalEnabled = false
			for i,v in pairs(script.Parent:GetChildren()) do
				pcall(function()
					v.Visible = true
				end)
			end
			game:GetService("GuiService").GuiNavigationEnabled = false
			pcall(function()
				plr.DevTouchMovementMode = Enum.DevTouchMovementMode.Scriptable
			end)
			Car = seat.Parent
			
		
		end
	else 
		Car = nil
		if (UserInputService.KeyboardEnabled) then
		--	print(" i hate myself ")	
		else
			UserInputService.ModalEnabled = true
			
			for i,v in pairs(script.Parent:GetChildren()) do
				pcall(function()
					v.Visible = false
				end)
			end
			game:GetService("GuiService").GuiNavigationEnabled = true
		pcall(function()
		plr.DevTouchMovementMode = Enum.DevTouchMovementMode.UserChoice
			end)	
			end

	end
end)

It always errors and says something like “lacking security permissions”

This is the last thing and my game will have mobile support.

The workaround I know.
You can disable the thumbstick and buttons from being visible for a brief period via:

local controlFrame = playerGui:WaitForChild("TouchGui").TouchControlFrame
controlFrame.Visible = false

To enable it back again:

local controlFrame = playerGui:WaitForChild("TouchGui").TouchControlFrame
controlFrame.Visible = true

You can be more in-depth and enable/disable certain components by setting their visibility based upon this hiearchy
image
So if we want to set the visibility of the thumbstickframe and keep buttons, you can do:

local thumbstickFrame = playerGui:WaitForChild("TouchGui").TouchControlFrame:WaitForChild("DynamicThumbstickFrame")
thumbstickFrame .Visible = false

And you can re-enable it with

local thumbstickFrame = playerGui:WaitForChild("TouchGui").TouchControlFrame:WaitForChild("DynamicThumbstickFrame")
thumbstickFrame .Visible = true