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
 

Re: LoadCharacter

Previous Thread :: Next Thread 
epicbreaker is not online. epicbreaker
Joined: 23 Apr 2011
Total Posts: 2791
30 Jan 2015 07:50 AM
I'm calling LoadCharacter through a RemoteEvent, however, before this, the CameraType is set to Scriptable.

When LoadCharacter is called, the player dissapears but the camera stays the same. In a localscript, I have set the CameraType back to Custom. The problem is that the camera won't go back to the player.

Can anybody see a reason why this isn't working properly (In Online mode)?
--------

LoadCharacter:
game.ReplicatedStorage.RemoteEvents.TeamChanger.OnServerEvent:connect(function(player, team)
player.TeamColor = game.Teams[team].TeamColor
player:LoadCharacter()
end)
--------

LocalScript, Change Team:
game.ReplicatedStorage.RemoteEvents.TeamChanger:FireServer("Raiders")
--------

LocalScript, Camera:
Player = game.Players.LocalPlayer
cam = game.Workspace.CurrentCamera
repeat wait() until Player.Character
cam.CameraType = "Custom"
Report Abuse
epicbreaker is not online. epicbreaker
Joined: 23 Apr 2011
Total Posts: 2791
30 Jan 2015 09:34 AM
Bump
Report Abuse
epicbreaker is not online. epicbreaker
Joined: 23 Apr 2011
Total Posts: 2791
30 Jan 2015 10:42 AM
Bump [2]
Report Abuse
tbnj123 is not online. tbnj123
Joined: 29 Oct 2010
Total Posts: 443
30 Jan 2015 11:18 AM
cam.CameraSubject = Player.Character.Humanoid
Report Abuse
Aceylos is not online. Aceylos
Joined: 26 Feb 2010
Total Posts: 8266
30 Jan 2015 11:40 AM
I'm assuming the location of this script is PlayerGui?
If so the script is being removed/reset when you call :LoadCharacter() before it has a chance to set the camera back.


- Ace
Report Abuse
epicbreaker is not online. epicbreaker
Joined: 23 Apr 2011
Total Posts: 2791
30 Jan 2015 11:41 AM
It would still run the code again, even if it was reset.
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
30 Jan 2015 12:54 PM
Just a guess, but when you fire this:

game.ReplicatedStorage.RemoteEvents.TeamChanger.OnServerEvent:connect(function(player, team)
player.TeamColor = game.Teams[team].TeamColor
player:LoadCharacter()
end)


Before firing LoadCharacter, set CameraType to it's default, then set CameraSubject to the Humanoid.

So

game.ReplicatedStorage.RemoteEvents.TeamChanger.OnServerEvent:connect(function(player, team)
player.TeamColor = game.Teams[team].TeamColor
--Default CameraType
--CameraSubject = player.Character.Humanoid
player:LoadCharacter()
end)


You can pick you method of doing this.
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