I can’t get the player to restart with (Morph), Thanks for the help!
--Remote Event
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Load = ReplicatedStorage.Load
local ChangeChar = ReplicatedStorage.ChangeChar
--On Event Functions
game:GetService("Players").PlayerAdded:Connect(function(Player)
local Morph = Instance.new("StringValue", script)
Morph.Name = Player.UserId .. "'s Morph"
Morph.Value = "DefaultAvatar"
end)
Load.OnServerEvent:Connect(function(Player, PlayerCF)
if script[Player.UserId .. "'s Morph"].Value ~= "DefaultAvatar" then
script[Player.UserId .. "'s Morph"].Value = "DefaultAvatar"
Player:LoadCharacter()
Player.Character.LowerTorso.CFrame = Player
end
end)
ChangeChar.OnServerEvent:Connect(function(Player, Character,Morph, PlayerCF)
local Humanoid = Character:WaitForChild("Humanoid")
if script[Player.UserId .. "'s Morph"].Value ~= Morph.Name then
script[Player.UserId.. "'s Morph"].Value = Morph.Name
local A = Morph:Clone()
A.Name = Player.Name
Player.Character = A
A.Parent = game.Workspace
Player.Character:WaitForChild("LowerTorso").CFrame = PlayerCF
Player.Character.Humanoid.Died:Connect(function()
wait(5)
local model = game:GetService("ReplicatedStorage").RealPlayers[Morph] --Find the morph in the folder*
local morph = model:Clone() --Clone it*
morph.Parent = workspace --Parent it to the workspace*
morph.HumanoidRootPart.CFrame = Player.Character.HumanoidRootPart.CFrame --Set it's position to the player's position*
morph.Name = Player.Name --Name it the player name*
wait()
Player.Character = morph --Set the morph to the character*
game:GetService("ReplicatedStorage").ChangeChar:FireClient(Player, morph)
wait(1)
end)
end
end)