Advertisement
HowToRoblox

MorphHandler

Oct 11th, 2021
1,881
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.59 KB | None | 0 0
  1. local part = script.Parent.MorphPart
  2.  
  3.  
  4. part.Touched:Connect(function(t)
  5.    
  6.     local player = game.Players:GetPlayerFromCharacter(t.Parent)
  7.    
  8.     if player then
  9.        
  10.         local morph = script.Parent.MorphCharacter:Clone()
  11.         morph.HumanoidRootPart.Anchored = false
  12.        
  13.        
  14.         for i, child in pairs(player.Character:GetChildren()) do
  15.            
  16.             if child:IsA("Script") or child:IsA("LocalScript") then
  17.                
  18.                 child:Clone().Parent = morph
  19.             end
  20.         end
  21.        
  22.        
  23.         morph:SetPrimaryPartCFrame(player.Character.PrimaryPart.CFrame)
  24.        
  25.         player.Character = morph
  26.        
  27.         morph.Parent = workspace
  28.     end
  29. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement