So I want to user UserInputService to get the device acceleration, then if it is over a certain amount, move the player forward. I used some code from the Roblox Developer Forums and edited it a bit to make this, but it is not working. It is inside of a LocalScript inside of the StarterPlayerScripts folder.
local UserInputService = game:GetService("UserInputService")
local camera = workspace.CurrentCamera
local accelerometerEnabled = UserInputService.AccelerometerEnabled
Players = game:GetService("Players")
while true do
if accelerometerEnabled then
local acceleration = UserInputService:GetDeviceAcceleration().Position
if acceleration > 10 then
local direction = camera.CFrame.LookVector
game.Players.LocalPlayer:Move(Vector3.new(direction), true)
end
else
warn("[DeltaVR] User does not have an enabled accelerometer!")
end
wait(0.1)
end
Sorry if my code is messy, or is way off. I am new! Thank you in advance.
- ItzHiimnew
