Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How do I properly make a weapon?

Asked by 10 years ago

I already have the gun ready, it's just that I have two issues. Problem number one is not being able to pull the gun out without it exploding. Second deal is I have no clue how to make animations for it. Thanks, I appreciate the help.

Also could you guys give me a quick tutorial about "local"?

2 answers

Log in to vote
0
Answered by
Kozero 120
10 years ago

I'm sorry I can't help with the gun but a tutorial about local. Instead of calling a variable in a chunk of code (function,loops,if statements, basically anything that needs an end)

function Hi()
Var=5
print (Var)
end

You could do this.

function Hi()
local Var=5
print (Var)
end

This basically deletes the Variable once the function has been complete but when fired again the variable will re appear and so on.

0
Itry to help and you down vote me... Kozero 120 — 10y
0
It doesn't explain the purpose of local variables very well, you should probably have a read of this article to learn how to phrase it better: http://wiki.roblox.com/index.php?title=Scope duckwit 1404 — 10y
0
English is my secondary language and I learn't it all by myself and no-one was there to teach me since I live in Libya. Nothing I can do about it. Kozero 120 — 10y
0
Kozero, I'm not criticising your English abilities - you are very good at speaking English! I know what it's like to learn a second language too, I lived in a latin-american country for 8 years and I'm English. That's why I referred you to the article though, sometimes the technical language can be harder to articulate in a second language, so reading the article might help to be more familiar wi duckwit 1404 — 10y
0
Thank you duckwit I'm sorry for any inconvenience Kozero 120 — 10y
Ad
Log in to vote
0
Answered by
duckwit 1404 Moderation Voter
10 years ago

Ah, so many questions in one!

"Being able to pull the gun out without it exploding"

You'll need to become familiar with the Weld Object, this is used to sustain parts relative to other parts (Weld them together)

http://wiki.roblox.com/index.php?title=Weld

There is a tutorial on using them here:

http://wiki.roblox.com/index.php?title=Welds

You can also find some ready-to-go "Autoweld" scripts in Free Models that do this sort of thing.

"I have no clue how to make animations for it"

Do you mean animating the gun itself, or the limbs of the Player who is using it?

If you mean the gun itself, you can animate it by adjusting the C0 and C1 (these are CFrames) properties of the Welds for each part that you want to animate.

If you mean the Player's limbs: You can find the Welds (They are actually Motor6Ds, but they behave the same when it comes to animating) holding the Player's arms and legs and head in the Torso, they are called Right Shoulder, Left Shoulder, Right Hip, Left Hip, and Neck. You can animate these by changing the C0 and C1 properties as well.

I hope that that's enough to get you started!

Edit: It's probably best to ask about "local" in a separate thread, also you haven't specified what you mean very well. You might be interested in LocalScripts:

http://wiki.roblox.com/index.php?title=Local_script

...or local variables, there is an article on those here (at the bottom):

http://wiki.roblox.com/index.php?title=Scope

Answer this question