Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- wait(1)
- local Players = game:GetService("Players")
- local LocalPlayer = Players.LocalPlayer
- local Character = LocalPlayer.Character
- local ReplicatedStorage = game:GetService("ReplicatedStorage")
- local Characters = ReplicatedStorage.Characters
- local remote = ReplicatedStorage.CharacterPosition
- local Stepped = game:GetService("RunService").RenderStepped
- local HB = game:GetService("RunService").Stepped
- local cf = CFrame.new
- local components = cf().components
- local inverse = cf().inverse
- local acos = math.acos
- local fromAxisAngle = CFrame.fromAxisAngle
- local v3 = Vector3.new
- function AxisAngleInterpolate(c0,c1,t)--CFrame0,CFrame1,Tween
- local _,_,_,xx,yx,zx,xy,yy,zy,xz,yz,zz=components(inverse(c0)*c1)
- local r=acos((xx+yy+zz-1)/2)*t
- local c=r==r and r~=0 and c0*fromAxisAngle(v3(yz-zy,zx-xz,xy-yx),r)+(c1.p-c0.p)*t or c0+(c1.p-c0.p)*t
- if c.lookVector.x==c.lookVector.x then return c else return c0 end
- end
- remote.OnClientEvent:connect(function(data)
- for plr,positions in pairs (data) do
- if plr == "Destroy these characters" then
- for _,k in pairs (positions) do
- if k and k~=Character.Name then
- local player = Players:FindFirstChild(k)
- if player then
- local FakeCharacter = ReplicatedStorage.BasePlayer:Clone()
- local DidItWork = ypcall(function()
- k = Players[k].Character
- FakeCharacter.Parent = workspace
- FakeCharacter.Torso.roblox.Texture = k.Torso.roblox.Texture
- for _,l in pairs (k.Head:GetChildren()) do
- l.Archivable = true
- l:Clone().Parent = FakeCharacter.Head
- end
- for _,j in pairs(k:GetChildren()) do
- if j:isA("CharacterMesh") then
- j:Clone().Parent = FakeCharacter
- elseif j:IsA("Hat") then
- local hat = j.Handle:Clone()
- hat.Name = j.Name
- hat.Parent = FakeCharacter
- hat.Anchored = true
- elseif j:IsA("BodyColors") or j:IsA("Shirt") or j:IsA("Pants") then
- j:Clone().Parent = FakeCharacter
- end
- end
- for _,h in pairs (k:GetChildren()) do
- if h.Name == "Head" then
- h.CanCollide = false
- h.Transparency = 1
- h.face.Transparency = 1
- else
- h:Destroy()
- end
- end
- FakeCharacter.Parent = k
- wait()
- k.Head.CanCollide = false
- for _,h in pairs (FakeCharacter:GetChildren()) do
- h.Name = h.Name.."Part"
- if h:IsA("BasePart") then
- h.CanCollide = false
- end
- end
- end)
- if not DidItWork then
- FakeCharacter:Destroy()
- end
- end
- end
- end
- break
- end
- local plrCharacter = Players[plr].Character
- if plrCharacter and plrCharacter:FindFirstChild("BasePlayer") then
- local dp = {}
- local LastCF = {}
- local StartCF = {}
- local cParts = plrCharacter.BasePlayer:GetChildren()
- for i = 1, #cParts do
- if cParts[i]:isA("BasePart") then
- LastCF[cParts[i].Name]=cParts[i].CFrame
- StartCF[cParts[i].Name]=cParts[i].CFrame
- end
- end
- for i = 1, 3 do
- for m,k in pairs (positions) do
- local pName = m.."Part"
- dp[pName]=true
- if plrCharacter.BasePlayer:FindFirstChild(pName) then
- if plrCharacter.BasePlayer[pName].CFrame == LastCF[pName] then
- plrCharacter.BasePlayer[pName].CFrame = AxisAngleInterpolate(StartCF[pName],k,i/3)
- end
- end
- end
- Stepped:wait()
- end
- end
- end
- end)
- local Removed = {}
- Character.ChildRemoved:connect(function(it)
- if it.ClassName == "Part" or it.ClassName == "Hat" then
- table.insert(Removed,it.Name)
- end
- end)
- repeat
- local parts = Character:GetChildren()
- local Positions = {}
- for i = 1, #parts do
- if parts[i].ClassName == "Part" then
- Positions[parts[i].Name]=parts[i].CFrame
- elseif parts[i].ClassName == "Hat" then
- Positions[parts[i].Name]=parts[i].Handle.CFrame
- end
- end
- if #Removed > 0 then
- for i = 1, #Removed do
- Positions[Removed[i]]=CFrame.new(0,-20,0)
- end
- Removed = {}
- end
- remote:FireServer(Positions)
- HB:wait()
- until Character.Humanoid.Health==0
Add Comment
Please, Sign In to add comment