|
| 18 Jul 2015 04:59 PM |
How come this works in play solo and not server?
Its a server script in workspace.
local cam = game.Workspace.CurrentCamera
game.Players.PlayerAdded:connect(function(p) repeat wait() until p.CharacterAdded p.Character:Destroy() cam.CameraSubject = game.Workspace.CarMod cam.CameraType = Enum.CameraType.Scriptable cam.CoordinateFrame = game.Workspace.CamObject.CFrame * CFrame.Angles(math.rad(-20),math.rad(-5),math.rad(0)) * CFrame.new(0,0,8) end) |
|
|
| Report Abuse |
|
|
| |
|
|
| 18 Jul 2015 05:01 PM |
| Your script need to be local to use it for client only. You dont want the whole server to look at your camera xD |
|
|
| Report Abuse |
|
|
|
| 18 Jul 2015 05:01 PM |
| No, it doesnt even work with a local script. |
|
|
| Report Abuse |
|
|
|
| 18 Jul 2015 05:02 PM |
| Still it need to be in a local script |
|
|
| Report Abuse |
|
|
|
| 18 Jul 2015 05:03 PM |
| It explained why your camera worked in solo and not in a server. |
|
|
| Report Abuse |
|
|
|
| 18 Jul 2015 05:03 PM |
game.Players.PlayerAdded:connect(function(p) local cam = game.Workspace.CurrentCamera repeat wait() until p.CharacterAdded p.Character:Destroy() cam.CameraSubject = game.Workspace.CarMod cam.CameraType = Enum.CameraType.Scriptable cam.CoordinateFrame = game.Workspace.CamObject.CFrame * CFrame.Angles(math.rad(-20),math.rad(-5),math.rad(0)) * CFrame.new(0,0,8) end)
Thats in a local script now, but it doesnt even destroy the character now.
Before it destroyed the character, but didnt move the camera (bc it was a server script) |
|
|
| Report Abuse |
|
|
| |
|
|
| 18 Jul 2015 05:20 PM |
b0mpppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp
halp |
|
|
| Report Abuse |
|
|
|
| 18 Jul 2015 05:24 PM |
I guess no ones gonna halp. #ForeverAlun |
|
|
| Report Abuse |
|
|
| |
|
|
| 18 Jul 2015 10:26 PM |
| GRSGRFEREW4T4T4TREFESFWADQwdqdwafesg |
|
|
| Report Abuse |
|
|
|
| 18 Jul 2015 10:29 PM |
| Players service can only be used from a script, while CurrentCamera can only be used from a localscript. You are trying to use both client and server code in one script. Please read the wiki for more information. |
|
|
| Report Abuse |
|
|
lordrambo
|
  |
| Joined: 16 Jun 2009 |
| Total Posts: 20628 |
|
|
| 18 Jul 2015 10:29 PM |
Must be in a local script, now wait for the character or something,
(at the top) if game.Players.LocalPlayer.Character == nil then game.Players.LocalPlayer.CharacterAdded:wait() end
will fix it |
|
|
| Report Abuse |
|
|
|
| 18 Jul 2015 10:30 PM |
Seriously? Was there an update to it?
Players service USED to work fine in a local script... |
|
|
| Report Abuse |
|
|
lordrambo
|
  |
| Joined: 16 Jun 2009 |
| Total Posts: 20628 |
|
|
| 18 Jul 2015 10:30 PM |
"Players service can only be used from a script" this is entirely incorrect, however you must be using a local script to access the camera. |
|
|
| Report Abuse |
|
|
|
| 18 Jul 2015 10:30 PM |
| @lord, I already wait for the character. |
|
|
| Report Abuse |
|
|
|
| 18 Jul 2015 10:31 PM |
| Directly from wiki for PlayerAdded: "Fires when a player enters the game. This event does not fire for LocalScripts - use ChildAdded instead." |
|
|
| Report Abuse |
|
|
lordrambo
|
  |
| Joined: 16 Jun 2009 |
| Total Posts: 20628 |
|
|
| 18 Jul 2015 10:33 PM |
local player = game.Players.LocalPlayer local character = player.Character or player.CharacterAdded:wait() local cam = game.Workspace.CurrentCamera
character:Destroy() cam.CameraSubject = game.Workspace.CarMod cam.CameraType = Enum.CameraType.Scriptable cam.CoordinateFrame = game.Workspace.CamObject.CFrame * CFrame.Angles(math.rad(-20),math.rad(-5),math.rad(0)) * CFrame.new(0,0,8)
using playerAdded in a local script isn't going to fire for you. |
|
|
| Report Abuse |
|
|
|
| 18 Jul 2015 10:33 PM |
Nope, pear was right.
I put it inside a starter gui now it works.
local cam = game.Workspace.CurrentCamera
script.Parent.Parent.CharacterAdded:connect(function() p = script.Parent.Parent print("Player added! Waiting for character...") repeat wait() print("Waiting...") until p.CharacterAdded print("Character loaded!") p.Character:Destroy() cam.CameraSubject = game.Workspace.CarMod cam.CameraType = Enum.CameraType.Scriptable cam.CoordinateFrame = game.Workspace.CamObject.CFrame * CFrame.Angles(math.rad(-20),math.rad(-5),math.rad(0)) * CFrame.new(0,0,8) print("Done!") end) |
|
|
| Report Abuse |
|
|
lordrambo
|
  |
| Joined: 16 Jun 2009 |
| Total Posts: 20628 |
|
|
| 18 Jul 2015 10:33 PM |
| And you clearly said the Players service, not the PlayerAdded event :P |
|
|
| Report Abuse |
|
|
|
| 18 Jul 2015 10:34 PM |
Players does work in a LS, but not pAdded. Use cAdded.
Also, CurrentCam can only be used in a LS. |
|
|
| Report Abuse |
|
|
lordrambo
|
  |
| Joined: 16 Jun 2009 |
| Total Posts: 20628 |
|
|
| 18 Jul 2015 10:36 PM |
| That's going to break as soon as more players start joining. Use the code I fixed for you, put it in a local script inside the startergui (will replicate to playergui so it can run). PlayerAdded should not be used in this situation. |
|
|
| Report Abuse |
|
|
|
| 18 Jul 2015 10:37 PM |
@lordrambo,
I've been up since 7 am this morning and didn't fall asleep until 3 am this morning. I haven't been double-checking my posts for errors, so it's my bad. |
|
|
| Report Abuse |
|
|