generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Need help

Previous Thread :: Next Thread 
WickedSiege is not online. WickedSiege
Joined: 03 Oct 2011
Total Posts: 3039
17 May 2014 01:25 PM
mouse = game.Players.LocalPlayer:GetMouse()
active = false

mouse.KeyDown:connect(function(key)
if key == "q" then
if active == false then
active = true
knife = script.Parent.Handle:Clone()
knife.Parent = game.Workspace
knife.CFrame = script.Parent.Handle.CFrame
--Help?
end
end
end)

Can some one make it so that the knife flys in the direction of the mouse? I tried using body thrust. I am not experienced with flying projectiles. Anybody?
Report Abuse
WickedSiege is not online. WickedSiege
Joined: 03 Oct 2011
Total Posts: 3039
17 May 2014 01:27 PM
._.
Report Abuse
WickedSiege is not online. WickedSiege
Joined: 03 Oct 2011
Total Posts: 3039
17 May 2014 01:31 PM
You ask for help, and you never get it.
Report Abuse
WickedSiege is not online. WickedSiege
Joined: 03 Oct 2011
Total Posts: 3039
17 May 2014 01:34 PM
I'm experimenting with Velocity. Each time I try changing it it goes a different direction. xD. Please help and try with velocity. I am not looking for a picture perfect throwing knife. I can imagine professional scripters right now in the Scripting Helpers forum. I am very calmly asking for a little help.
Report Abuse
WickedSiege is not online. WickedSiege
Joined: 03 Oct 2011
Total Posts: 3039
17 May 2014 01:38 PM
Velocity ain't working. I got it going in the right direction and poof. But then, I turned to a different direction and OF COURSE IT WON'T GO THAT WAY. Nobody wants to assist me. That's cool.
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
17 May 2014 01:38 PM
What "other direction"?
Report Abuse
WickedSiege is not online. WickedSiege
Joined: 03 Oct 2011
Total Posts: 3039
17 May 2014 01:41 PM
Don't you get it? I threw it when I was streight. It went streight. I turned to the side. It still goes streight. I can't figure this out.
Report Abuse
WickedSiege is not online. WickedSiege
Joined: 03 Oct 2011
Total Posts: 3039
17 May 2014 01:48 PM
Bump 1,000,000
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
17 May 2014 01:48 PM
Do you want it to go in the direction of the mouse or the barrel?
If the barrel, just use barrel.CFrame.lookVector * x
Report Abuse
WickedSiege is not online. WickedSiege
Joined: 03 Oct 2011
Total Posts: 3039
17 May 2014 01:52 PM
In the direction of the mouse, please. I'm not desperate. Well, I am 'kinda' trying a bunch of different things in studio. Nothing works.
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
17 May 2014 01:56 PM
mouse.Hit.p.Unit is the direction of which the mouse is pointing
Report Abuse
WickedSiege is not online. WickedSiege
Joined: 03 Oct 2011
Total Posts: 3039
17 May 2014 02:00 PM
I want the knife to fly towards the mouse's location
Report Abuse
WickedSiege is not online. WickedSiege
Joined: 03 Oct 2011
Total Posts: 3039
17 May 2014 02:02 PM
I'll buy a gear from ur place if u can make it do that Dx
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
17 May 2014 02:02 PM
knife.Velocity = mouse.Hit.p.Unit * speed
--and handle gravity with a bodyforce or something
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
17 May 2014 02:02 PM
I don't want you to buy a gear from my place because I'm not going to take the time to insert a gear when I could be helping people...
Report Abuse
WickedSiege is not online. WickedSiege
Joined: 03 Oct 2011
Total Posts: 3039
17 May 2014 02:03 PM
Well thank you cnt, I will try this and modify it.
Report Abuse
WickedSiege is not online. WickedSiege
Joined: 03 Oct 2011
Total Posts: 3039
17 May 2014 02:06 PM
Does bodyforce have to have specific properties?
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
17 May 2014 02:07 PM
Here's a basic way to cancel out gravity with a part.

local bodyForce = Instance.new("BodyForce", part);
bodyForce.force = Vector3.new(0, 196.2 * part:GetMass(), 0);
Report Abuse
WickedSiege is not online. WickedSiege
Joined: 03 Oct 2011
Total Posts: 3039
17 May 2014 02:09 PM
Here's what I have:

mouse = game.Players.LocalPlayer:GetMouse()
active = false

mouse.KeyDown:connect(function(key)
if key == "q" then
if active == false then
active = true
knife = script.Parent.Handle:Clone()
knife.Parent = game.Workspace
knife.CFrame = script.Parent.Handle.CFrame
knife.Velocity = mouse.Hit.p.Unit * 2
local bodyForce = Instance.new("BodyForce",knife);
bodyForce.force = Vector3.new(0, 196.2 * knife:GetMass(), 0);
end
end
end)



But, instead of flying in the right direction, it goes to the side. Very slowly. :(
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
17 May 2014 02:12 PM
knife.CFrame = script.Parent.Handle.CFrame.lookVector * script.Parent.Handle.Size.Z/2;
knife.Velocity = mouse.Hit.p.Unit * 50; --more speed.
local bodyForce = Instance.new("BodyForce",knife);
bodyForce.force = Vector3.new(0, 196.2 * knife:GetMass(), 0);
Report Abuse
WickedSiege is not online. WickedSiege
Joined: 03 Oct 2011
Total Posts: 3039
17 May 2014 02:16 PM
Players.Player1.Backpack.Knife.Throw:10: bad argument #3 to 'CFrame' (CFrame expected, got userdata)


I am experienced. Sometimes I don't understand output. Ik what to do but it seems difficult.
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
17 May 2014 02:17 PM
knife.Position = script.Parent.Handle.CFrame.lookVector * script.Parent.Handle.Size.Z/2;

I forgot to change it to Position
Report Abuse
WickedSiege is not online. WickedSiege
Joined: 03 Oct 2011
Total Posts: 3039
17 May 2014 02:22 PM
Now it won't even fly! No output. It isn't ur fault. What I want is simply incredibly hard to make. But I do see a handle in workspace.
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
17 May 2014 02:25 PM
What you are doing is easy to make, I've done it hundreds of times, I don't know why it's not working for you.
Whether you are doing something wrong or the handle isn't actually attached to the tool is beyond me.

I could try to help you over team viewer if you really need to.
Report Abuse
WickedSiege is not online. WickedSiege
Joined: 03 Oct 2011
Total Posts: 3039
17 May 2014 02:26 PM
I can make it a model and send it to you via message?
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image