[C#] Why does my chest-close-animation not play?

Hey people :slight_smile:

I have b een working on this chest script, and it works 90%, as the “open” animation plays when my player is in range, and clicks his right mouse button. The “open” animation then plays in reverse (effectively a close animation) when the chest is open and the player walks out of range, but if the chest is open, and the player right-clicks the chest, it should also play the reverse “open” animation - but it doesn’t.

Can anyone enlighten me on why it doesn’t? :slight_smile:

Link to the script:

I know things could probably be optimized in the script - I’m not very good of a programmer, so bear with me :wink:

Thanks in advance the the help guys :slight_smile:

plenty of open-close doors tutorials on YouTube…can easy be adapted to open-close chest

you set the speed back to 1 in the same frame on line 114…

1 Like

@herman111
I’m sorry, but it’s so annoying when asking some question on a forum, someone turns up stating “Look up a tutorial”.
I know there are tons of tutorials out there, but I want to make my own scripts and incorporate as little copy/pasting as possible. I know I could have just watched a tutorial and see how other people are doing it, but I want to use my brain.
And surely enough, I didn’t need a tutorial, since the error is, like @LeftyRighty said, in Line 114. Something you could have noticed, had you just cared enough to make a good answer, if you had actually looked at the code you are commenting on.

@LeftyRighty
thank you, this fixed it obviously. :slight_smile: Sometimes you can stare yourself blind on your code, and having others look it over often reveals issues like this :slight_smile:
You have my gratitude.

sorry for the answer, that’s what people tell me to do…I’m looking for answers to my problem posted on here.I look at other scripts and do change them for my purpose

1 Like