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 » Scripters
Home Search
 

Works in studio but not server?

Previous Thread :: Next Thread 
LIETUVA159 is not online. LIETUVA159
Joined: 17 Aug 2008
Total Posts: 740
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 is not online. 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
LIETUVA159 is not online. LIETUVA159
Joined: 17 Aug 2008
Total Posts: 740
18 Apr 2015 07:52 PM
@Rayk what do you mean??
Report Abuse
rayk999 is not online. 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
LIETUVA159 is not online. LIETUVA159
Joined: 17 Aug 2008
Total Posts: 740
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 is not online. 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 is not online. 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
LIETUVA159 is not online. LIETUVA159
Joined: 17 Aug 2008
Total Posts: 740
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 is not online. 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 is not online. 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
LIETUVA159 is not online. LIETUVA159
Joined: 17 Aug 2008
Total Posts: 740
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
LIETUVA159 is not online. LIETUVA159
Joined: 17 Aug 2008
Total Posts: 740
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
LIETUVA159 is not online. LIETUVA159
Joined: 17 Aug 2008
Total Posts: 740
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
LIETUVA159 is not online. LIETUVA159
Joined: 17 Aug 2008
Total Posts: 740
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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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