Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do you clone a brick into a player?

Asked by
Smunkey 95
8 years ago

I am currently working on morph script that copies parts a humanoid in replicatedstorage and clones them into your character. However when I try to clone a brick it just sticks it becomes a separate entity inside of the player rather than being attached to said player.

the script i currently have is here, with line 12 being the problem

local player = game.Players.LocalPlayer
local cactus = game.ReplicatedStorage.brawler.cactusg


function onClicked()
player.Character.Head.face.Texture = cactus.Head.Decal.Texture
cactus.Shirt:clone().Parent = player.Character
cactus.Pants:clone().Parent = player.Character
player.Character["Left Arm"].BrickColor = BrickColor.new("Camo")
player.Character["Right Arm"].BrickColor = BrickColor.new("Camo")
player.Character["Torso"].BrickColor = BrickColor.new("Camo")
cactus.Head:clone().Parent = player.Character.Head
end

script.Parent.MouseButton1Click:connect(onClicked)

I have tried cloning cactus.Head into a bunch of different place into the player to no avail, and have run out of ideas.

2 answers

Log in to vote
0
Answered by 8 years ago

So you've successfully gotten the cactus in the Character right? If that's the case you just have to stick it to the head with a weld.

Simple weld with a bit to help the cactus sticking:

cactushead = cactus.Head:Clone()
cactushead.Parent = player.Character
W = Instance.new("Weld",player.Character.Head)
W.Part0 = W.Parent
W.Part1 = cactushead

And I wouldn't recommend putting parts in parts, don't let me stop you from your dreams though.

EDIT: Here's a link to Welds to further your understanding of these incredibly useful and beautifully simple joints.

0
Beautiful, apologize for not getting to this sooner. Smunkey 95 — 8y
0
Still one problem. while cactus.Head attaches perfectly, it's children will still fall to the floor despite my attempts to try and expand the script to clone them as separate from the head with their own new welds Smunkey 95 — 8y
0
So you're trying to weld a model of sorts to the Head? Like a hat? I would weld each part of the hat model to eachother first, and use cactus.head as a basepart to then weld to the character's head. I don't put parts within parts in a hierarchy because joints (in this case, welds) fail to function properly. If the right-click -> insert-object prompt doesn't- Dynamese 35 — 8y
0
-list the object (part in a part), it's best not to force it. Dynamese 35 — 8y
Ad
Log in to vote
0
Answered by
Benqazx 108
8 years ago
local player = game.Players.LocalPlayer
local cactus = game.ReplicatedStorage.brawler.cactusg


function onClicked()
player.Character.Head.face.Texture = cactus.Head.Decal.Texture
cactus.Shirt:clone().Parent = player.Character
cactus.Pants:clone().Parent = player.Character
player.Character["Left Arm"].BrickColor = BrickColor.new("Camo")
player.Character["Right Arm"].BrickColor = BrickColor.new("Camo")
player.Character["Torso"].BrickColor = BrickColor.new("Camo")
cactus.Head:clone().Parent = player.Character.Head
end

script.Parent.MouseButton1Click:connect(onClicked)

the code is fine. if i am correct the problem is not with the code it is with the type of script you are using.

local player = game.Players.LocalPlayer
         -- local player is used when you are using a localscript.

if you are not using a local script then use that for this code

0
The script works just fine apart from the above mentioned cloned cactus.Head part not being physically attached to the player but rather being inside the player as a separate entity. Smunkey 95 — 8y
0
oh sorry i didnt read all of it. Benqazx 108 — 8y

Answer this question