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.
Never did anything like this, do some print debugging to find out the actual number that the accelerometer spits out and if it spits out anything, that is.
Ok. It appears to spit out X,Y,Z coordinates from what I am seeing. Link below to picture. When I move the device, the numbers grow depending on which way I move the device.
https://prnt.sc/oab64s