This is a bare bones noclip/fly script I’ve using, (not mine). What’s the easiest way to make this mobile compatible?
local userinput = game:GetService("UserInputService")
local tool = script.Parent
local player = game.Players.LocalPlayer
local cam = workspace.CurrentCamera
local equipped = false
local speed = 120 -- This is the default
function getNextMovement()
local nextMove = Vector3.new(0,0,0)
if userinput:IsKeyDown("W") then
nextMove = nextMove + Vector3.new(0,0,-.01)
end
if userinput:IsKeyDown("S") then
nextMove = nextMove + Vector3.new(0,0,.01)
end
if userinput:IsKeyDown("A") then
nextMove = nextMove + Vector3.new(-.01,0,0)
end
if userinput:IsKeyDown("D") then
nextMove = nextMove + Vector3.new(.01,0,0)
end
if userinput:IsKeyDown("Space") then
nextMove = nextMove + Vector3.new(0,.01,0)
elseif userinput:IsKeyDown("LeftControl") then
nextMove = nextMove + Vector3.new(0,-.01,0)
end
return CFrame.new(nextMove*speed)
end
tool.Equipped:Connect(function()
local Equip = tool.CoilSound
Equip:Play()
local human = player.Character.Humanoid
local rootpart = player.Character.HumanoidRootPart
human.PlatformStand = true
rootpart.Anchored = true
selected = true
while selected do
wait()
local look = (cam.Focus.Position - cam.CFrame.Position).Unit
local pos = rootpart.Position
local nextMove = getNextMovement()
rootpart.CFrame = CFrame.new(pos,pos+look) * nextMove
end
end)
tool.Unequipped:Connect(function()
selected = false
player.Character.Humanoid.PlatformStand = false
player.Character.HumanoidRootPart.Anchored = false
end)