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: Please tell me there's a better way to do this.

Previous Thread :: Next Thread 
Klink45 is not online. 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
nQqzRYVpIKA5jLP is not online. nQqzRYVpIKA5jLP
Joined: 05 Mar 2015
Total Posts: 4135
29 May 2015 07:20 PM
Here is what you are doing:

{Table of all the children}:Clone()
Report Abuse
cpmoderator12345 is not online. cpmoderator12345
Joined: 26 Jan 2013
Total Posts: 15651
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 is not online. 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 is not online. 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
nQqzRYVpIKA5jLP is not online. nQqzRYVpIKA5jLP
Joined: 05 Mar 2015
Total Posts: 4135
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 is not online. 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
nQqzRYVpIKA5jLP is not online. nQqzRYVpIKA5jLP
Joined: 05 Mar 2015
Total Posts: 4135
29 May 2015 07:30 PM
HOW DARE YOU ASK THAT? jk


Player.Character:Destroy()
Player.Character = newcharclone
Report Abuse
Klink45 is not online. 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
nQqzRYVpIKA5jLP is not online. nQqzRYVpIKA5jLP
Joined: 05 Mar 2015
Total Posts: 4135
29 May 2015 07:33 PM
You may have to call :MakeJoints() once you parent the new character as well.
Report Abuse
Klink45 is not online. 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
TheNewChicken is not online. TheNewChicken
Joined: 18 Mar 2015
Total Posts: 1997
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 is not online. 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 is not online. 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 is not online. 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 is not online. ash877
Joined: 18 Feb 2008
Total Posts: 5142
29 May 2015 07:49 PM
easy...

workspace.CurrentCamera.CameraSubject=model.Humanoid
Report Abuse
TheNewChicken is not online. TheNewChicken
Joined: 18 Mar 2015
Total Posts: 1997
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 is not online. 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
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