Local bg = Instance.new("BodyGyro", myHRP) Local bp = Instance.new("BodyPosition", myHRP)
![make players press n for noclip roblox make players press n for noclip roblox](https://i.gyazo.com/710aac9c86cc3d9843a6b9c7689cac6a.png)
#Make players press n for noclip roblox code
The end code looks a lil’ like this: local uis = game:GetService("UserInputService") You’ll need another function that lets you stop the person from flying. Local speed = 0.5 - Speed of flight is kind of determined by thisĪnd now the function can be written: function fly()īp.MaxForce = Vector3.new(400000,400000,400000)īg.MaxTorque = Vector3.new(400000,400000,400000)īp.Position = myHRP.Position +((myHRP.Position - ).unit * speed)īg.CFrame = CFrame.new(, myHRP.Position)īut this will force you to fly forever. Local rs = game:GetService("RunService") - Look me up Local flying = false - Determines if you're in flight or not Local bg = Instance.new("BodyGyro", myHRP) - Body Gyro that determines your rotation Local bp = Instance.new("BodyPosition", myHRP) - Body Position that determines your location Local myHRP = m圜har:WaitForChild("HumanoidRootPart") I’ll lay them all out here: local myPlayer = This is going to be the bulk of your code, and I’ll write a fairly quick example of how you could write the flying “physics”.įirst things first, you need a few variables set up. We’ll call this function “Fly” function fly() Next up, you’ll need a function for flying that is called whenever your user presses the space bar. Again, this isn’t really all too difficult. You then need to make it so that it detects when the user has pressed the key desired. This gets all the things the UIS can do for us. Easy! local uis = game:GetService("UserInputService") I don’t know quite how new you are to scripting, so I’ll assume you understand code but don’t know the specifics.įirst things first, you need to get the UserInputService.