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: Can't get the gun to stay where it's supposed to

Previous Thread :: Next Thread 
xiaoxiao181 is not online. xiaoxiao181
Joined: 14 Aug 2008
Total Posts: 5882
20 Feb 2014 05:20 PM
Cam = game.Workspace.CurrentCamera
Char = game.Players.LocalPlayer.Character

Cam.Changed:connect(function()
Char.Head.Weld.C0 = (CFrame.new(1, -1, -1) * CFrame.Angles(0, 1.57, 0))
* Cam.CoordinateFrame
end)


There are no errors, it's just that the C0 property of the weld is being set so that the gun is positioned elsewhere in workspace instead of at (CFrame.new(1, -1, -1) * CFrame.Angles(0, 1.57, 0))

I thought that (* Cam.CoordinateFrame) would cause the gun to angle in the direction of the camera but instead it's positioning it. I dunno what to do now. It's all going down the toilet from here.
Report Abuse
xiaoxiao181 is not online. xiaoxiao181
Joined: 14 Aug 2008
Total Posts: 5882
20 Feb 2014 05:35 PM
bump
Report Abuse
xiaoxiao181 is not online. xiaoxiao181
Joined: 14 Aug 2008
Total Posts: 5882
20 Feb 2014 05:54 PM
Cam = game.Workspace.CurrentCamera
Char = game.Players.LocalPlayer.Character

Cam.Changed:connect(function()
Char.Head.WWeld.C0 = (Cam.CoordinateFrame - Cam.CoordinateFrame.p)
end)


I tried it this way and while it does work (sort of) when the camera is zoomed out, it does not work when it is zoomed in.


When the camera is zoomed in, the C0 property is rotated faster than the camera is.

Why did i say sort of? Well, because the C0 property rotates the same speed when zoomed out, but ONLY lines up if you zoom in and line the part up with the camera. Otherwise if you zoom in and the part is facing right, it stays facing right when you zoom out and rotate.

Idk what to do now.

All I want is for the part to be first person and always face the direction of the camera like the guns in Battlefield do.
Report Abuse
xiaoxiao181 is not online. xiaoxiao181
Joined: 14 Aug 2008
Total Posts: 5882
20 Feb 2014 06:08 PM
bump
Report Abuse
xiaoxiao181 is not online. xiaoxiao181
Joined: 14 Aug 2008
Total Posts: 5882
20 Feb 2014 08:03 PM
bump
Report Abuse
xiaoxiao181 is not online. xiaoxiao181
Joined: 14 Aug 2008
Total Posts: 5882
20 Feb 2014 08:36 PM
bump
Report Abuse
xiaoxiao181 is not online. xiaoxiao181
Joined: 14 Aug 2008
Total Posts: 5882
20 Feb 2014 09:19 PM
bump
Report Abuse
xiaoxiao181 is not online. xiaoxiao181
Joined: 14 Aug 2008
Total Posts: 5882
20 Feb 2014 10:05 PM
bump
Report Abuse
xiaoxiao181 is not online. xiaoxiao181
Joined: 14 Aug 2008
Total Posts: 5882
20 Feb 2014 10:41 PM
bump
Report Abuse
xiaoxiao181 is not online. xiaoxiao181
Joined: 14 Aug 2008
Total Posts: 5882
20 Feb 2014 11:57 PM
bump
Report Abuse
islandmaker2012 is not online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
21 Feb 2014 12:07 AM
I don't really DO cameras..so..best thing I can do for u sadly is:
Bump!
Honestly,someone must know how to do this
Report Abuse
xiaoxiao181 is not online. xiaoxiao181
Joined: 14 Aug 2008
Total Posts: 5882
21 Feb 2014 12:25 AM
it's not that they don't know how but rather that 1) Im not too well liked here in the forums and 2) i dont express my gratitude as often as i should when they do help.

I really am trying to change and be a better person but its hard when nobody gives u the chance lol.

anyway, bump.
Report Abuse
islandmaker2012 is not online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
21 Feb 2014 12:33 AM
Bump again :3
Report Abuse
iYoshiFox is not online. iYoshiFox
Joined: 14 Apr 2012
Total Posts: 1058
21 Feb 2014 01:51 AM
So ur trying to get le gun to follow ur cam? XD

Cam.Changed:connect(function()
local pos = CFrame.new(1, -1, -1) * CFrame.Angles(0, 1.57, 0)
Char.Head.Weld.C0 = CFrame.new(pos.p, Cam.Focus.p)
end)

--Try dat. :P
Report Abuse
xiaoxiao181 is not online. xiaoxiao181
Joined: 14 Aug 2008
Total Posts: 5882
21 Feb 2014 10:35 AM
lol now it dont move at all xD
Report Abuse
xiaoxiao181 is not online. xiaoxiao181
Joined: 14 Aug 2008
Total Posts: 5882
21 Feb 2014 03:29 PM
bump
Report Abuse
TWCgraphic is not online. TWCgraphic
Joined: 01 Oct 2013
Total Posts: 1157
21 Feb 2014 03:31 PM
go to scripters forum
for some reason people here just tell you to get out
Report Abuse
islandmaker2012 is not online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
21 Feb 2014 03:31 PM
Bump,do people on this forum seriously hate you or something?
Bump
Bump
Bump
Bump
FIRIN MAH SUPER EPIC LAZER-BUMP
Report Abuse
islandmaker2012 is not online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
21 Feb 2014 03:32 PM
Nu-uh,This Does NOT go to scripting forums..
This is scripting helpers where it should be..
Report Abuse
xiaoxiao181 is not online. xiaoxiao181
Joined: 14 Aug 2008
Total Posts: 5882
21 Feb 2014 03:58 PM
T_T

bump
Report Abuse
xiaoxiao181 is not online. xiaoxiao181
Joined: 14 Aug 2008
Total Posts: 5882
21 Feb 2014 04:36 PM
bump
Report Abuse
xiaoxiao181 is not online. xiaoxiao181
Joined: 14 Aug 2008
Total Posts: 5882
21 Feb 2014 05:07 PM
bump
Report Abuse
islandmaker2012 is not online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
21 Feb 2014 05:10 PM
This is sad..
Ik what to do tho(maybe):D
Repost this thread and name it"this gun/cam script isn't working?help!"
And since name is diffrent,maybe they'll help ?:3
Report Abuse
xiaoxiao181 is not online. xiaoxiao181
Joined: 14 Aug 2008
Total Posts: 5882
21 Feb 2014 05:31 PM
i s'pose it's worth a try but i can almost guarantee you the result will be the same.

you know ive gotten help faster on scripts that were too large to post in the forums?
this is rediculous lol. its like all the smart people packed up and just left cuz roblox is like gonna s'plode or somethin lol
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