|
| 18 Apr 2015 07:50 PM |
Gui = script.Parent.Parent.Parent.Parent.Parent Me = Gui.Parent.Parent PlayerGui = Me.PlayerGui Backpack = Me.Backpack Character = Me.Character Humanoid = Character.Humanoid
function Click(mouse) script.Parent.Parent.Parent.Parent.Parent.Speed.Visible = true script.Parent.Parent.Parent.Parent.Parent.Gui.Visible = true script.Parent.Parent.Parent.Parent.Parent.Rotation.Disabled = true script.Parent.Parent.Parent.Logo.Visible = false workspace.CurrentCamera.CameraSubject = Humanoid end
script.Parent.MouseButton1Down:connect(Click)
This script works perfectly fine in Play Solo, but when I join a game through the Play button and execute the script the camera doesn't come back to my character. This is in a normal script inside a gui button. Please help! |
|
|
| Report Abuse |
|
|
rayk999
|
  |
| Joined: 18 Feb 2011 |
| Total Posts: 4705 |
|
|
| 18 Apr 2015 07:51 PM |
| There's no reason to put a script inside the player Object |
|
|
| Report Abuse |
|
|
| |
|
rayk999
|
  |
| Joined: 18 Feb 2011 |
| Total Posts: 4705 |
|
|
| 18 Apr 2015 07:52 PM |
Well, you are trying to access the Camera, but you can't do that from a server script. You have to use a local script and it makes things like defining the player easier
player = game.Players.LocalPlayer |
|
|
| Report Abuse |
|
|
|
| 18 Apr 2015 07:55 PM |
| @Rayk I have put the script inside a LocalScript, but I'm getting the same problem except that it doesn't even give me control of the camera anymore which it did before, but it wasn't focused on the character. |
|
|
| Report Abuse |
|
|
rayk999
|
  |
| Joined: 18 Feb 2011 |
| Total Posts: 4705 |
|
|
| 18 Apr 2015 07:57 PM |
| You cannot access the mouse object or the Camera object from a server script. Just because its parent is localscript doesn't mean that it is a localscript. |
|
|
| Report Abuse |
|
|
rayk999
|
  |
| Joined: 18 Feb 2011 |
| Total Posts: 4705 |
|
|
| 18 Apr 2015 07:58 PM |
| I misunderstood you, I thought you meant that you made a localscript, and then put the actual script as a child under it. lol. |
|
|
| Report Abuse |
|
|
|
| 18 Apr 2015 07:58 PM |
| Wait what, I don't understand anything lol, could you please tell me what to do to fix this? |
|
|
| Report Abuse |
|
|
iiEssence
|
  |
| Joined: 18 Jun 2014 |
| Total Posts: 3467 |
|
|
| 18 Apr 2015 07:59 PM |
use local script
define me as game.Players.LocalPlayer |
|
|
| Report Abuse |
|
|
rayk999
|
  |
| Joined: 18 Feb 2011 |
| Total Posts: 4705 |
|
|
| 18 Apr 2015 08:00 PM |
Let me redefine some stuff
Me = game.Players.LocalPlayer Character = Me.Character or Me.CharacterAdded:wait() Humanoid = Character:WaitForChild("Humanoid") Backpack = Me:WaitForChild("Backpack") PlayerGui = Me.PlayerGui |
|
|
| Report Abuse |
|
|
|
| 18 Apr 2015 08:04 PM |
Gui = script.Parent.Parent.Parent.Parent.Parent Me = game.Players.LocalPlayer Character = Me.Character or Me.CharacterAdded:wait() Humanoid = Character:WaitForChild("Humanoid") Backpack = Me:WaitForChild("Backpack") PlayerGui = Me.PlayerGui
function Click(mouse) script.Parent.Parent.Parent.Parent.Parent.Speed.Visible = true script.Parent.Parent.Parent.Parent.Parent.Gui.Visible = true script.Parent.Parent.Parent.Parent.Parent.Rotation.Disabled = true script.Parent.Parent.Parent.Logo.Visible = false workspace.CurrentCamera.CameraSubject = Humanoid end
script.Parent.MouseButton1Down:connect(Click)
Inside a local script.
Same problem :/ |
|
|
| Report Abuse |
|
|
|
| 18 Apr 2015 08:08 PM |
| Rayk can you add me so we can talk about this? I'll show you what happens in-game |
|
|
| Report Abuse |
|
|
|
| 18 Apr 2015 08:12 PM |
Found an error!
Players.LIETUVA159.PlayerGui.MainGui.Characters.1.Character:4: attempt to index global 'Character' (a nil value) |
|
|
| Report Abuse |
|
|
|
| 18 Apr 2015 08:15 PM |
| Nvm that error has nothing to do with my problem. So can anyone help? I've been taking to myself for the past couple of posts.... |
|
|
| Report Abuse |
|
|