ausmel105
|
  |
| Joined: 05 Oct 2010 |
| Total Posts: 251 |
|
|
| 16 Apr 2016 10:23 AM |
Hi all,
I'm trying to make a free cam which can be toggled on or off, rather simple you'd think.. but no :L I'm having issues finding a way in which to recover the character once it's been set to nil. I've tried numerous methods, but setting the character to equal nil and setting the camera type fixed appears to be the only way to achieve a free cam.
For whatever reason I'm unable to clone the existing character for later use, as setting the character instance to equal nil is an unrecoverable operation.
Anyway looking for some logic inspiration on how to do this,
this is my local script as it stands:
game.Players.LocalPlayer.CharacterAdded:wait()
local sp = script.Parent local freecam = false local char
sp.freecam.MouseButton1Click:connect(function() if not freecam then char = game.Players.LocalPlayer.Character:Clone() char.Parent = game.Players.LocalPlayer game.Players.LocalPlayer.Character=nil workspace.CurrentCamera.CameraType = "Fixed" else workspace.CurrentCamera.CameraType = "Custom" char.Parent = workspace game.ReplicatedStorage.Respawn:FireServer(game.Players.LocalPlayer) end freecam = not freecam end) |
|
|
| Report Abuse |
|
|
|
| 16 Apr 2016 10:24 AM |
| http://wiki.roblox.com/index.php?title=Camera_manipulation#Fixing_the_camera_once_we.27re_done. |
|
|
| Report Abuse |
|
|
malachi11
|
  |
| Joined: 07 May 2008 |
| Total Posts: 2420 |
|
|
| 16 Apr 2016 10:25 AM |
| I seem to remember from a long time ago that you used to need to change the archivable property of the character before cloning it... I don't remember what you needed to change it to, and I don't know if it is still like that, but you could try that. |
|
|
| Report Abuse |
|
|
ausmel105
|
  |
| Joined: 05 Oct 2010 |
| Total Posts: 251 |
|
|
| 16 Apr 2016 10:29 AM |
@direMitten
Won't work as the character doesn't exist. |
|
|
| Report Abuse |
|
|
ausmel105
|
  |
| Joined: 05 Oct 2010 |
| Total Posts: 251 |
|
|
| 16 Apr 2016 10:29 AM |
@malachi11
Yes! That worked, thank you. |
|
|
| Report Abuse |
|
|
|
| 16 Apr 2016 10:32 AM |
| Can't you just set the player.Character to the character again? |
|
|
| Report Abuse |
|
|