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

how do i throw a part? read Desc

I made a "part a tool" and I want to know how do I make a key press that wil throe the part straight ahead of me? does it deal with Velocity?

2 answers

Well, first off. You're going to need to use CFrames to put the part in front of you and yes it uses BodyVelocity. You put the BodyVelocity in the part and then if you want it to depend on where the character is looking, lookVector will help. I am not going to provide you with a script, but I will give you some advice.

Here's a link that should help you with CFrames and lookVector:

http://wiki.roblox.com/index.php/CFrame

3 comments

0

so how could exactly use "look Vector"? with velocity?

0

lookVector is a property of CFrame. It uses which way the character is facing.

0

can some one explain the script that is down there?...

If you have the script directly inside the tool and the part as the handle then.

local plyr = game.Players.LocalPlayer
local char = game.Workspace:WaitForChild(plyr.Name)
script.Parent.Activated:Connect(function()
	script.Parent.Part.CFrame = CFrame.new(char.Head.Position.X,char.Head.Position.Y + 2,char.Head.Position.Z)
	script.Parent = game.Workspace
	script.Parent.Part.Velocity = Vector3.new(char.Head.CFrame.Lookvector)
end)

try that.

3 comments

0

what does "Head.Postion.Y + 2" means...can some one explain this script?...

0

It means that it's 2 studs (I think) off of the Head. It takes the Head's position and just adds two to it.

0

OHHHH.wow thanx

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