Character Morph Help

So basically, I want to make a character morph on the character when the player equips a tool

-- Local script in tool
local playerToIgnore = game.Players.LocalPlayer
script.Parent.Equipped:Connect(function(playerToIgnore)
    game.ReplicatedStorage.ayayayaya:FireServer()
end)
-- Script in ServerScriptService
local D = game.ReplicatedStorage.D:Clone()
local DParts = {
D.Torso,
D:FindFirstChild("Left Leg"),
D:FindFirstChild("Right Leg"),
D:FindFirstChild("Right Arm"),
D:FindFirstChild("Left Arm"),
D.Head
}
game.ReplicatedStorage.ayayayaya.OnServerEvent:Connect(function(playerToIgnore)
    D.Parent = playerToIgnore
    playerToIgnore.Torso:Destroy()
    playerToIgnore:FindFirstChild("Left Arm"):Destroy()
    playerToIgnore:FindFirstChild("Right Arm"):Destroy()
    playerToIgnore:FindFirstChild("Right Leg"):Destroy()
    playerToIgnore:FindFirstChild("Left Leg"):Destroy()
    playerToIgnore.Head:Destroy()
end)

The error is that ‘Torso’ is not a valid member of player, even thought it is.

1 Like

Using remote events, the first variable that it returns isn’t the player’s character, but the player itself. You could try adding .Character to it, to refer to the character, and then body part.

Still doesn’t work and the error is still the same

Try waiting for the character?

repeat wait() until playerToIgnore.Character
--and then run the code

Please do not use repeat wait() until --something

Just do something like this:

local Character = playerToIgnore.Character or playerToIgnore.CharacterAdded:Wait()

You need to distinguish between character and player object. As Ender_BX already said, you need the player’s character, not the player object itself. You get the player’s character by doing the following:

local Character = playerToIgnore.Character or playerToIgnore.CharacterAdded:Wait()

Player.Character is a reference to the players character model. If there is none. Player.Character returns nil

1 Like

I put that in the local script right?

-- Local script in tool
local playerToIgnore = game.Players.LocalPlayer
local Character = playerToIgnore.Character or playerToIgnore.CharacterAdded:Wait()
script.Parent.Equipped:Connect(function(playerToIgnore)
    game.ReplicatedStorage.ayayayaya:FireServer()
end)
-- Script in ServerScriptService
local D = game.ReplicatedStorage.D:Clone()
local DParts = {
D.Torso,
D:FindFirstChild("Left Leg"),
D:FindFirstChild("Right Leg"),
D:FindFirstChild("Right Arm"),
D:FindFirstChild("Left Arm"),
D.Head
}
game.ReplicatedStorage.ayayayaya.OnServerEvent:Connect(function(playerToIgnore)
    D.Parent = playerToIgnore
    playerToIgnore.Character.Torso:Destroy()
    playerToIgnore.Character:FindFirstChild("Left Arm"):Destroy()
    playerToIgnore.Character:FindFirstChild("Right Arm"):Destroy()
    playerToIgnore.Character:FindFirstChild("Right Leg"):Destroy()
    playerToIgnore.Character:FindFirstChild("Left Leg"):Destroy()
    playerToIgnore.Character.Head:Destroy()
end)

EDIT: It kills the player, and still is not morphing

after you have defined the variable character, you have to use Character.Torso instead of:

Also, Destroying the Head or the Torso is the same thing as doing Humanoid.Health = 0 I would recommend you just set the transparency to 1 for every body part.

Ok but how do I make the character into that model?

Also please note that R6 and R15 have differences in body parts.

Yes I know, my game is a R6 game

Now, to morph it, make the specific body parts(canCollide = false) and morph then player by setting each part on each corresponding body part’s CFrame. Then, weld that part to it.

How do I do the welding part, I’m not that good at welding

I learned about welding through a script with this video, this might help you too: https://www.youtube.com/watch?time_continue=64&v=LEy0po6sLso&feature=emb_logo

you should try humanoid description