- Home /
Question by
chris gough · Nov 29, 2010 at 02:23 PM ·
syntax-errorcrouch
my crouch script isnt working
if (Input.GetKeyDown ("Crouch")) {
transform.localScale.y = 0.5;
}
(Input.GetKeyUp ("crouch")) {
transform.localScale.y : 1
};
This is what i have so far, this is my first script and it is placed inside the First Person Controller can someone help me to figure out why it isnt working please.
Comment
Answer by skovacs1 · Nov 29, 2010 at 03:04 PM
There are several things wrong with the second half of your code:
- You have no if before the Input.GetKeyUp.
- You check a key "crouch" which is different from the "Crouch" you entered previously if the Input functions are case sensitive.
- You indicate transform.localscale.y to be of type 1 with the use of : (colon). 1 is not a type.
- You don't assign the value of transform.localscale.y so once it is set to 0.5, it will stay 0.5.
- You are missing a semi-colon at the end of the line where you indicate transform.localscale.y to be of type 1.
You got it wright in the first half. Why didn't you just copy/paste the first part and change Down to Up and 0.5 to 1?
Your answer

Follow this Question
Related Questions
How To Make The FPS Character Crouch 8 Answers
Can stand up beneath a collider 1 Answer
How do I add a sprint recharge 1 Answer
Need help with crouching,Problem with crouching 1 Answer
How "include" the Raycast?! 1 Answer