This is inside a part shaped like a arm in workspace, once i touch it i inherit the things below, how can i make it so it becomes my left and right arm, like a zombie once i touch it.
function morph(hit)
if hit.Parent:FindFirstChild("Humanoid") ~= nil then
local player = hit.Parent:FindFirstChild("Humanoid").Parent
local bodycolors = player:FindFirstChild('Body Colors')
--changes body color
bodycolors.HeadColor = BrickColor.new('Artichoke')
bodycolors.RightArmColor = BrickColor.new('Artichoke')
bodycolors.LeftArmColor = BrickColor.new('Artichoke')
bodycolors.LeftLegColor = BrickColor.new('Artichoke')
bodycolors.RightLegColor = BrickColor.new( 'Artichoke')
bodycolors.TorsoColor = BrickColor.new('Artichoke')
--changes face
player.Head.face.Texture = 'http://www.roblox.com/asset/?id=174393211'
--changes animation
local animate = script.Parent.Animate:Clone()
player.Animate:Destroy()
animate.Parent = player
animate.Disabled = false
end
--removes accessories
local d = hit.Parent:GetChildren()
for i=1, #d do
if (d[i].className == "Accessory") then
d[i]:remove()
end
end
end
script.Parent.Touched:connect(morph)
Like this?
it casues an error idk if i put it right
[Workspace.Smooth Block Model.Script:26: attempt to index local ‘player’ (a nil value)]
function morph(hit)
if hit.Parent:FindFirstChild("Humanoid") ~= nil then
local player = hit.Parent:FindFirstChild("Humanoid").Parent
local bodycolors = player:FindFirstChild('Body Colors')
--changes body color
bodycolors.HeadColor = BrickColor.new('Artichoke')
bodycolors.RightArmColor = BrickColor.new('Artichoke')
bodycolors.LeftArmColor = BrickColor.new('Artichoke')
bodycolors.LeftLegColor = BrickColor.new('Artichoke')
bodycolors.RightLegColor = BrickColor.new( 'Artichoke')
bodycolors.TorsoColor = BrickColor.new('Artichoke')
--changes face
player.Head.face.Texture = 'http://www.roblox.com/asset/?id=174393211'
--changes animation
local animate = script.Parent.Animate:Clone()
player.Animate:Destroy()
animate.Parent = player
animate.Disabled = false
end
local player = game.Players.LocalPlayer
local character = player.Character
character.LeftUpperArm.LeftShoulder.Transform = character.LeftUpperArm.LeftShoulder.Transform * CFrame.Angles(math.rad(90), 0, 0)
character.RightUpperArm.RightShoulder.Transform = character.RightUpperArm.RightShoulder.Transform * CFrame.Angles(math.rad(90), 0, 0)
--removes accessories
local d = hit.Parent:GetChildren()
for i=1, #d do
if (d[i].className == "Accessory") then
d[i]:remove()
end
end
end
script.Parent.Touched:connect(morph)