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: Please fix

Previous Thread :: Next Thread 
Biostream is not online. Biostream
Joined: 28 Mar 2011
Total Posts: 913
13 Jul 2011 05:39 PM
This is a simple script that I didnt put much thought into.
script.Parent.Selected:connect(function(m)
m.Button1Down:connect(function()
local fireball = game.Lighting.FireBall:clone()
fireball.Parent = game.Workspace
fireball.Position = script.Parent.Parent.Parent.Character.Torso.Position + Vector3.new(5, 0, 0)
fireball.BodyVelocity.velocity = m.Hit.p
end)
end)

What it does it it shoots the ball at a position way out in space. Anybody know why?
Report Abuse
ShoeBox4 is not online. ShoeBox4
Joined: 06 Apr 2011
Total Posts: 890
13 Jul 2011 05:49 PM
script.Parent.Selected:connect(function(m)
m.MouseButton1Down:connect(function()
local fireball = game.Lighting.FireBall:clone()
fireball.Parent = game.Workspace
fireball.Position = script.Parent.Parent.Parent.Character.Torso.Position + Vector3.new(5, 0, 0)
fireball.BodyVelocity.velocity = m.Hit.p
end)
end)

Report Abuse
Biostream is not online. Biostream
Joined: 28 Mar 2011
Total Posts: 913
13 Jul 2011 05:56 PM
All you did was copy my script and break it by adding 'mouse' in front of Button1Down. Which I dont even need to test to know that it doesnt work. MouseButton1Down is for GUI buttons and stuff. You dont need to put Mouse if its in a hopperbin that already identifies it as a mouse.
Report Abuse
benningtonguy is not online. benningtonguy
Joined: 21 Dec 2008
Total Posts: 18166
13 Jul 2011 06:04 PM
It hits at your mouse's hit position, which is out in space.
Report Abuse
Biostream is not online. Biostream
Joined: 28 Mar 2011
Total Posts: 913
13 Jul 2011 06:06 PM
Oh. Whoops. Thanks but how might I fix that?
Report Abuse
DingDong272 is not online. DingDong272
Top 100 Poster
Joined: 08 Dec 2007
Total Posts: 9860
13 Jul 2011 06:07 PM
Give it a set velocity. You don't want variable velocity, that's never good.
Report Abuse
Biostream is not online. Biostream
Joined: 28 Mar 2011
Total Posts: 913
13 Jul 2011 06:08 PM
Wait a second. I thought I couldnt give BodyVelocity a set velocity unless thats where I wanted to shoot the ball every single time.
Report Abuse
DingDong272 is not online. DingDong272
Top 100 Poster
Joined: 08 Dec 2007
Total Posts: 9860
13 Jul 2011 06:10 PM
You can make the fireball shoot in the direction the player is facing using some math and .lookVector
Report Abuse
Biostream is not online. Biostream
Joined: 28 Mar 2011
Total Posts: 913
13 Jul 2011 06:12 PM
That would work, except for the fact that I want the ball to shoot where the player clicks.
Report Abuse
DingDong272 is not online. DingDong272
Top 100 Poster
Joined: 08 Dec 2007
Total Posts: 9860
13 Jul 2011 06:14 PM
Then you want to index m.Hit.p before you set the velocity. Like this:

firePos = m.Hit.p
-- rest of code
[bVelocity].velocity = firePos
Report Abuse
Biostream is not online. Biostream
Joined: 28 Mar 2011
Total Posts: 913
13 Jul 2011 06:18 PM
Didnt change anything.
Report Abuse
Biostream is not online. Biostream
Joined: 28 Mar 2011
Total Posts: 913
13 Jul 2011 06:56 PM
print("Bump")
Report Abuse
Biostream is not online. Biostream
Joined: 28 Mar 2011
Total Posts: 913
13 Jul 2011 07:53 PM
Bump. This is mainly intended for DingDong since he is the only good scripter on.
Report Abuse
DingDong272 is not online. DingDong272
Top 100 Poster
Joined: 08 Dec 2007
Total Posts: 9860
13 Jul 2011 08:03 PM
Well what do you want the ball to do, exactly?
Report Abuse
Biostream is not online. Biostream
Joined: 28 Mar 2011
Total Posts: 913
13 Jul 2011 08:03 PM
Like a... let me find a metaphor here... like an iceshard. Wherever you click, it shoots a ball that way.
Report Abuse
DingDong272 is not online. DingDong272
Top 100 Poster
Joined: 08 Dec 2007
Total Posts: 9860
13 Jul 2011 08:05 PM
Wouldn't you be able to modify a premade paintball gun (you can replace the Handle). The math in there already shoots where you are aiming. And no BodyVelocity is used, it's just the Velocity property of the Part firing.
Report Abuse
Biostream is not online. Biostream
Joined: 28 Mar 2011
Total Posts: 913
13 Jul 2011 08:06 PM
Aha. Good idea. Its a hopperbin though, and spawning normally has to do with the handles position. But no matter, I am on another mission.
Report Abuse
Biostream is not online. Biostream
Joined: 28 Mar 2011
Total Posts: 913
13 Jul 2011 08:23 PM
I was looking at the paintball gun script and I came across this. I semi-understand it, but it would help if somebody could explain this.

local targetPos = humanoid.TargetPoint
local lookAt = (targetPos - character.Head.Position).unit
Report Abuse
DingDong272 is not online. DingDong272
Top 100 Poster
Joined: 08 Dec 2007
Total Posts: 9860
13 Jul 2011 08:27 PM
humanoid.TargetPoint is where the humanoid is going.
lookAt is the distance between the character's head and it's end position.
Report Abuse
Biostream is not online. Biostream
Joined: 28 Mar 2011
Total Posts: 913
13 Jul 2011 08:32 PM
I understood that much, but what is .unit?
Report Abuse
DingDong272 is not online. DingDong272
Top 100 Poster
Joined: 08 Dec 2007
Total Posts: 9860
13 Jul 2011 08:36 PM
Print it.
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