Hello! I made a morph that morph a rig to the character but after I got morph, I got kick of of the morph [here]()
There are no errors and here is the script! Helps are appreciated.
local prompt = script.Parent
replicatedstorage = game:GetService("ReplicatedStorage")
local Characters = replicatedstorage.Characters
local SetSubject = Characters.Parent.SetSubject
prompt.Triggered:Connect(function(Player)
for index,item in pairs(Characters:GetChildren()) do
local ChosenCharacter = item:Clone()
local CurrentCharacter = Player.Character
local LocalScripts = {}
for index2,item2 in pairs(game.StarterPlayer.StarterCharacterScripts:GetChildren()) do
if item2:IsA('LocalScript') then
table.insert(LocalScripts,item2:Clone())
else
item2:Clone().Parent = ChosenCharacter
end
end
CurrentCharacter.Health:Clone().Parent = ChosenCharacter
table.insert(LocalScripts,CurrentCharacter.Animate:Clone())
ChosenCharacter.Parent = workspace
Player.Character = ChosenCharacter
for index2,item2 in pairs(LocalScripts) do
item2.Parent = ChosenCharacter
end
SetSubject:FireClient(Player,ChosenCharacter.Humanoid)
local Connection
local function onDied()
wait(game.Players.RespawnTime)
Player:LoadCharacter()
script.Parent.Enabled = true
if Connection then
Connection:Disconnect()
end
end
Connection = ChosenCharacter.Humanoid.Died:Connect(onDied)
end
end)