johnville
|
  |
| Joined: 12 Oct 2008 |
| Total Posts: 388 |
|
|
| 16 Apr 2016 09:38 AM |
--when i move my camera is supposed to make some fluid movement left to right
local d = 2 local s = 7
game:GetService("RunService").Stepped:connect(function() local cam = workspace.CurrentCamera
cam.CoordinateFrame = cam.CoordinateFrame * CFrame.Angles(0,0, math.rad( d * math.sin( tick() * s ) ) ) end
--what did i do wrong? please help
|
|
|
| Report Abuse |
|
|
ebm4321
|
  |
| Joined: 09 Jan 2012 |
| Total Posts: 74 |
|
|
| 16 Apr 2016 10:03 AM |
replace that end with a end)
|
|
|
| Report Abuse |
|
|
johnville
|
  |
| Joined: 12 Oct 2008 |
| Total Posts: 388 |
|
|
| 17 Apr 2016 10:37 PM |
Yeah i noticed i forgot the ")" but i think it has to do with "Stepped:connect(function()" i dont think it knows im trying to make the camera move when i move forward
help please |
|
|
| Report Abuse |
|
|
Darkenus
|
  |
| Joined: 17 Jul 2014 |
| Total Posts: 1997 |
|
|
| 17 Apr 2016 11:45 PM |
make sure its a localscript.
im pretty sure the connection part and the code is solid and good.
maybe its your math? |
|
|
| Report Abuse |
|
|
johnville
|
  |
| Joined: 12 Oct 2008 |
| Total Posts: 388 |
|
|
| 18 Apr 2016 12:26 AM |
Yeah its a local script but everything there looks fine, it just doesnt seem to understand that when a player moves the camera is suppose to move < >
it has to be around Stepped:conncent(funtion()
someone help |
|
|
| Report Abuse |
|
|
johnville
|
  |
| Joined: 12 Oct 2008 |
| Total Posts: 388 |
|
|
| 18 Apr 2016 12:36 AM |
Hmm i tried doing this
local d = 2 local s = 7
function onRunning(speed) while true do local cam = workspace.CurrentCamera cam.CoordinateFrame = cam.CoordinateFrame * CFrame.Angles(0,0, math.rad( d * math.sin( tick() * s ) ) ) end end
there were no errors in output, script is local, it just isnt working, someone please help! |
|
|
| Report Abuse |
|
|
johnville
|
  |
| Joined: 12 Oct 2008 |
| Total Posts: 388 |
|
|
| 18 Apr 2016 12:51 AM |
okay so basically im trying to make it to where when a player moves and keeps moving the camera constantly moves left to right just for a little realism in FPS mode.
someone please help! |
|
|
| Report Abuse |
|
|
johnville
|
  |
| Joined: 12 Oct 2008 |
| Total Posts: 388 |
|
|
| 18 Apr 2016 01:07 AM |
| im sorry for spamming i really need help |
|
|
| Report Abuse |
|
|
johnville
|
  |
| Joined: 12 Oct 2008 |
| Total Posts: 388 |
|
| |
|
Thy_Yuno
|
  |
| Joined: 15 Jul 2014 |
| Total Posts: 239 |
|
| |
|
johnville
|
  |
| Joined: 12 Oct 2008 |
| Total Posts: 388 |
|
|
| 18 Apr 2016 02:45 AM |
| aw come on dude why, why must thy trolleth me |
|
|
| Report Abuse |
|
|
| |
|
johnville
|
  |
| Joined: 12 Oct 2008 |
| Total Posts: 388 |
|
|
| 18 Apr 2016 04:57 AM |
| no its not, its not a local script either! |
|
|
| Report Abuse |
|
|
johnville
|
  |
| Joined: 12 Oct 2008 |
| Total Posts: 388 |
|
| |
|
| |
|
|
| 18 Apr 2016 10:19 AM |
| What exactly is going on? The camera isn't moving? |
|
|
| Report Abuse |
|
|
|
| 18 Apr 2016 10:23 AM |
Add this line: cam.CameraType = Enum.CameraType.Scriptable; |
|
|
| Report Abuse |
|
|
johnville
|
  |
| Joined: 12 Oct 2008 |
| Total Posts: 388 |
|
|
| 18 Apr 2016 10:01 PM |
no the camera does not move (left and right) when its supposed to -- when i move
also even after adding the line the script still doesnt know what im trying to say but i understand what i kind of missed.
so im trying to make it to where when the player moves forward the camera function takes place
|
|
|
| Report Abuse |
|
|
|
| 18 Apr 2016 11:13 PM |
leaning up your code a bit:
local d = 2; local s = 7;
local cam = workspace.CurrentCamera; cam.CameraType = Enum.CameraType.Scriptable;
game:GetService("RunService").RenderStepped:connect(function() cam.CoordinateFrame = cam.CoordinateFrame * CFrame.Angles(0, 0, math.rad(d*math.sin(tick()*s))); end)
It moves, but doesn't follow the player. Up to you to fix it the way you like. |
|
|
| Report Abuse |
|
|
|
| 18 Apr 2016 11:19 PM |
I wrote this earlier, but you can use t if you want. Not quite done with it yet (to my standards at least)
local camera = game.Workspace.CurrentCamera; camera.CameraType = Enum.CameraType.Scriptable;
repeat wait() until game.Players.LocalPlayer.Character;
local char = game.Players.LocalPlayer.Character;
game:GetService("RunService").RenderStepped:connect(function() local camPos = char.Head.CFrame * CFrame.new(0,3,10); camera.CoordinateFrame = CFrame.new(camPos.p, char.Head.CFrame.p); end) |
|
|
| Report Abuse |
|
|
|
| 18 Apr 2016 11:26 PM |
Its not a local script... Thats why..
|
|
|
| Report Abuse |
|
|
Thy_Yuno
|
  |
| Joined: 15 Jul 2014 |
| Total Posts: 239 |
|
|
| 18 Apr 2016 11:37 PM |
@Brick
"there were no errors in output, *******script is local*******, it just isnt working, someone please help!"
I thought people in PB are supposed to be smart? |
|
|
| Report Abuse |
|
|
|
| 18 Apr 2016 11:46 PM |
@Thy "no its not, its not a local script either!" I thought scripters could read....
|
|
|
| Report Abuse |
|
|
Thy_Yuno
|
  |
| Joined: 15 Jul 2014 |
| Total Posts: 239 |
|
|
| 19 Apr 2016 06:38 AM |
| I read the main thread topic, not the other posts |
|
|
| Report Abuse |
|
|
Unravaled
|
  |
| Joined: 18 Jul 2011 |
| Total Posts: 1117 |
|
|
| 19 Apr 2016 07:05 AM |
PB ~= Smart, was a BoD there.
But on topic, as the others have said, I don't see an issue.
|
|
|
| Report Abuse |
|
|