Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Full prone script? (Kind of a toughy)

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.

  • Sorry that it's a long question and it's probably going to take a lot of time for you to make/teach me how to make the script. I really appreciate the time and effort you put for others :)

9 comments

0

One quick add-one, I meant to say you go prone when you press c twice. I already made a crouch script for when you press c just once.

0

Please do not Request on this site.

0

I'm sorry if you misunderstood, I'm not requesting anything, I'm just asking for information to guide me in the right direction because I'm kind of lost :P

0

You said on line 2: I need a script where when you press "c" your player goes prone

0

Yes, that is my end goal. I said I needed to make that script, and I asked for help on how to make it. What's so hard to understand?

0

This question is on the side or a Request and yet I guess it's kind of okay. The best thing you can do is look at scripts for prone in free models and read their code. Also, look at ROBLOX wiki for animations.

0

btw the way, how do you do that dot thing?

0

I did a - and it made it into a dash.

0

dot* I mean sorry.

1 answer

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 =)

This discussion is preserved as it was. New answers, comments, and votes are closed.