So I'm just beginning to learn Scripting on ROBLOX so I need help going in the right direction. I need a script where when you press "c" your player goes prone. I've made a simple one where your legs go back but your Torso stands straight up, but I want to make a prone script where your entire body is on the ground (Including your arms). To sum it up I just want to make a realistic prone system. Can somebody tell me how this could be done in the simplest way possible because I am a complete noob (I'll need somebody to walk me through it). Also, I want to eventually also create a crawling animation to go with the prone stance, thanks.
First, try using CFrame or clerp
function clerp(part,npv,nrv,alpha) local rot=part.Rotation:Lerp(nrv,alpha) part.CFrame=CFrame.new(part.Position:Lerp(npv,alpha))*CFrame.Angles(math.rad(rot.x),math.rad(rot.y),math.rad(rot.z)) end
This is called clerp because it is CFrame and lerp (Linear interpolation). I read on ROBLOX wiki that lerp is kinda a "tween" effect, like if you animate, theres that in between part. It also gives a start and a end point. If you want to add the second part, or the other script tutorial I guess, try scrolling down to that big part.
You will probably do your word, and make the animation. Make sure the priority is Idle or Movement. You can try KeyDown animating if clerp is a bit to much for your crawling.
plr = game.Players.LocalPlayer mouse = plr:GetMouse() cam = game.Workspace.CurrentCamera local crawling = false mouse.KeyDown:connect(function(button) local key = button:byte() if key == 99 then if crawling == false then crawling = true game.Workspace:FindFirstChild(plr.Name).Humanoid.WalkSpeed = 5 for i=70,80,2 do cam.FieldOfView = i wait() end end end end) mouse.KeyUp:connect(function(button) local key = button:byte() if key == 99 then if crawling == true then plr.Character.Humanoid.WalkSpeed = 16 for i=80,70,-2 do cam.FieldOfView = i wait() end crawling = false end end end)
the end)
means return end. I think return end means repeating the script if the hotkey is pressed again because a while true do
wont work
I am just a simple scripter and took basic scripting tutorials from the ROBLOX Youtube.
Have fun with this script, because I literally wrote all of the KeyDown part =)