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: Making a cannon! HELP!

Previous Thread :: Next Thread 
1234Christopher is not online. 1234Christopher
Joined: 21 Oct 2008
Total Posts: 1715
02 Aug 2013 08:49 PM
I want to spawn the bullet at the triggers position but I want to spawn it say... 2 studs to the left of it and 1 stud up of the trigger.


How do I plus position values???
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
02 Aug 2013 08:49 PM
+ Vector3.new(2, 1, 0)
or is it -2, 1, 0
wutev
Report Abuse
1234Christopher is not online. 1234Christopher
Joined: 21 Oct 2008
Total Posts: 1715
02 Aug 2013 08:53 PM
So bullet.CFrame = trigger.Position + Vector3.new(2, 1, 0)
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
02 Aug 2013 08:54 PM
You may as well do bullet.Position, but yeah, try it
Report Abuse
1234Christopher is not online. 1234Christopher
Joined: 21 Oct 2008
Total Posts: 1715
02 Aug 2013 08:57 PM
Yeah, having it as CFrame caused errors, but position works. Thanks.
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
02 Aug 2013 08:58 PM
np
Report Abuse
1234Christopher is not online. 1234Christopher
Joined: 21 Oct 2008
Total Posts: 1715
04 Aug 2013 10:50 AM
OK, another problem....

parts = trigger.Parent:GetChildren()
for i,v in ipairs(parts) do
parts.Position = parts.Position - Vector3.new(2,0,0)
wait(.5)
parts.Position = parts.Position + Vector3.new(2,0,0)
end

This is the simple recoil on the cannon. It doesn't work.
The out put says:
Workspace.Cannon.Trigger.Making:38: bad argument #1 to '?' (Vector3 expected, got nil)
Report Abuse
evolvedpikachu is not online. evolvedpikachu
Joined: 18 Aug 2010
Total Posts: 10696
04 Aug 2013 10:51 AM
parts.Position = Vector3.new(parts.Position) - Vector3.new(2,0,0)
wait(.5)
parts.Position = Vector3.new(parts.Position) + Vector3.new(2,0,0)
Report Abuse
ScrewDeath is not online. ScrewDeath
Joined: 03 Jun 2012
Total Posts: 2700
04 Aug 2013 10:53 AM
@evopika "Vector3.new(parts.Position)" why you doin that


parts = trigger.Parent:GetChildren()
for i,v in ipairs(parts) do
v.Position = v.Position - Vector3.new(2,0,0)
wait(.5)
v.Position = v.Position + Vector3.new(2,0,0)
end
Report Abuse
1234Christopher is not online. 1234Christopher
Joined: 21 Oct 2008
Total Posts: 1715
04 Aug 2013 11:06 AM
Yeah what evolved said didn't work.
And He has his brackets mixed up.
I will try the suggestion above.
Report Abuse
1234Christopher is not online. 1234Christopher
Joined: 21 Oct 2008
Total Posts: 1715
04 Aug 2013 11:09 AM
Erm, it works.

However because some of the bricks are rotated they move in different directions.

Anyone know what I could use for a better recoil script?


Report Abuse
1234Christopher is not online. 1234Christopher
Joined: 21 Oct 2008
Total Posts: 1715
04 Aug 2013 11:51 AM
bump.
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