Klink45
|
  |
| Joined: 06 Jun 2011 |
| Total Posts: 26054 |
|
|
| 29 May 2015 07:17 PM |
I'm trying to "morph" my player, and so far, I have hit many roadblocks.
local p = game.Players:WaitForChild("Player").Character local char = game.ServerStorage:WaitForChild("Characters") local newchar = char:WaitForChild("Klink45") local newcharstuff = newchar:GetChildren()
function Morph() for i, v in pairs (newcharstuff) do newcharstuff:Clone().Parent = p end end Morph()
The one I'm stuck on is that on the clone line, I receive this error: 19:14:42.352 - Workspace.Script:8: attempt to call method 'Clone' (a nil value) Anyway, since this probably isn't the best way to do it, what would you suggest? |
|
|
| Report Abuse |
|
|
|
| 29 May 2015 07:20 PM |
Here is what you are doing:
{Table of all the children}:Clone() |
|
|
| Report Abuse |
|
|
|
| 29 May 2015 07:21 PM |
local p = game.Players:WaitForChild("Player").Character local char = game.ServerStorage:WaitForChild("Characters") local newchar = char:WaitForChild("Klink45") local newcharstuff = newchar:GetChildren()
function Morph() for i, v in pairs (newcharstuff) do local ccs = newcharstuff[i] ccs:Clone().Parent = p end end Morph()
// cpmoderator \\ INTJ personality // |
|
|
| Report Abuse |
|
|
Klink45
|
  |
| Joined: 06 Jun 2011 |
| Total Posts: 26054 |
|
|
| 29 May 2015 07:22 PM |
| Ohhhh. Would I have to clone the model then? |
|
|
| Report Abuse |
|
|
Klink45
|
  |
| Joined: 06 Jun 2011 |
| Total Posts: 26054 |
|
|
| 29 May 2015 07:23 PM |
| Thanks cp, but I would like to know why that fixes it so I can get better. |
|
|
| Report Abuse |
|
|
|
| 29 May 2015 07:23 PM |
| Just iterate through the table and clone it's children. Another thing you could try is to just clone the newchar, then destroy the player's old character and replace it will newchar. |
|
|
| Report Abuse |
|
|
Klink45
|
  |
| Joined: 06 Jun 2011 |
| Total Posts: 26054 |
|
|
| 29 May 2015 07:25 PM |
| How would I destroy the other character and replace it, if you don't mind me asking? |
|
|
| Report Abuse |
|
|
|
| 29 May 2015 07:30 PM |
HOW DARE YOU ASK THAT? jk
Player.Character:Destroy() Player.Character = newcharclone |
|
|
| Report Abuse |
|
|
Klink45
|
  |
| Joined: 06 Jun 2011 |
| Total Posts: 26054 |
|
|
| 29 May 2015 07:31 PM |
| Thanks! The way I was doing it was basically breaking everything regarding the character! |
|
|
| Report Abuse |
|
|
|
| 29 May 2015 07:33 PM |
| You may have to call :MakeJoints() once you parent the new character as well. |
|
|
| Report Abuse |
|
|
Klink45
|
  |
| Joined: 06 Jun 2011 |
| Total Posts: 26054 |
|
|
| 29 May 2015 07:34 PM |
Thanks for the information, but I die whenever I try to change it now:
local p = game.Players:WaitForChild("Player") local char = game.ServerStorage:WaitForChild("Characters") local newchar = char:WaitForChild("Klink45") local newcharstuff = newchar:GetChildren()
function Morph() wait (10) local New = game.ServerStorage:WaitForChild("Characters"):WaitForChild("Klink45"):Clone() New:MakeJoints() p.Character:Destroy() p.Character = New end Morph()
|
|
|
| Report Abuse |
|
|
|
| 29 May 2015 07:44 PM |
i posted on the last thread, klink.
"You don't want to be their cool. Be a good person by a respectable figures point; you." ~ TheNewChicken. |
|
|
| Report Abuse |
|
|
ash877
|
  |
| Joined: 18 Feb 2008 |
| Total Posts: 5142 |
|
|
| 29 May 2015 07:44 PM |
| You didn't parent New to workspace. After parenting New to workspace then call MakeJoints() |
|
|
| Report Abuse |
|
|
Klink45
|
  |
| Joined: 06 Jun 2011 |
| Total Posts: 26054 |
|
|
| 29 May 2015 07:47 PM |
@New I'll look into that, I'm interested in learning this myself though. @Ash That didn't kill me, but it did break my camera. How can I fix it? |
|
|
| Report Abuse |
|
|
Klink45
|
  |
| Joined: 06 Jun 2011 |
| Total Posts: 26054 |
|
|
| 29 May 2015 07:48 PM |
| Oh also New, I can't really apply your scripts into what I'm trying to make. Thanks though. |
|
|
| Report Abuse |
|
|
ash877
|
  |
| Joined: 18 Feb 2008 |
| Total Posts: 5142 |
|
|
| 29 May 2015 07:49 PM |
easy...
workspace.CurrentCamera.CameraSubject=model.Humanoid |
|
|
| Report Abuse |
|
|
|
| 29 May 2015 07:49 PM |
Well, i thought that was wut you wanted.
"You don't want to be their cool. Be a good person by a respectable figures point; you." ~ TheNewChicken. |
|
|
| Report Abuse |
|
|
Klink45
|
  |
| Joined: 06 Jun 2011 |
| Total Posts: 26054 |
|
|
| 29 May 2015 07:50 PM |
| Ash, thank you so much. You deserve a medal. |
|
|
| Report Abuse |
|
|