I have made my own rig and set up a morph block so that when a player touches the block their character becomes this new rig.
Below is the script I use
local morph = game.Workspace.Newnpc.NPC --location of new rig
local pad = script.Parent --MorphBlock
local db = false
pad.Touched:connect(function(hit)
if db == false then
db = true
local par = hit.Parent
if par.ClassName == "Model" then
local hum = par:FindFirstChild("Humanoid")
if hum then
local ply = game.Players:GetPlayerFromCharacter(par)
if ply then
local morphClone = morph:Clone()
morphClone.Name = par.Name
morphClone.Parent = game.Workspace
morphClone.PrimaryPart.CFrame = par.PrimaryPart.CFrame + Vector3.new(0,5, 0)
ply.Character = morphClone --***This Line Is Where The Player Respawns for no reason***--
for i, v in pairs(par:GetChildren())do
if v:IsA("Part") or v:IsA("MeshPart") then
if v.Name == "Head" then
v.face.Transparency = 1
end
v.Transparency = 1
else
if v:IsA("Accessory") then
v:FindFirstChildOfClass("Part").Transparency = 1
end
end
end
--par:Destroy()
game.Workspace.Camera.CameraSubject = morphClone.Humanoid
end
end
end
wait(5)
db = false
end
end)
I'm not receiving any errors in the output but I have figured out that the player respawns when the code reaches line 18. When I remove that line the code works perfectly except for the player can't control the new rig.
Any assistance will be very much appreciated, thanks, IncredibleTeamAidan
