Advertisement
Guest User

Untitled

a guest
Feb 21st, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.71 KB | None | 0 0
  1. local ReplicatedStorage = game:GetService("ReplicatedStorage")
  2. local ShadowEvent = ReplicatedStorage.ShadowEvent
  3.  
  4. local function RemoveClone(plr)
  5. if workspace:FindFirstChild(plr.Name..'Clone') then
  6. local Clone = workspace[plr.Name..'Clone']
  7. Clone:Destroy()
  8. end
  9. end
  10.  
  11. local CurrentClone = 0
  12. local CloneLife = 60
  13.  
  14. local function CloneCharacter(plr)
  15. local Char = plr.Character or plr.CharacterAdded:Wait()
  16. Char.Archivable = true
  17. local Poof = ReplicatedStorage.CloneEffect:Clone()
  18. Poof.CFrame = Char.HumanoidRootPart.CFrame
  19. Poof.Parent = workspace
  20. Poof.ParticleEmitter.Enabled = true
  21. game:GetService("Debris"):AddItem(Poof, 0.5)
  22. local Clone = Char:Clone()
  23. Clone.Name = plr.Name..'Clone'
  24. Clone:SetPrimaryPartCFrame(Char.HumanoidRootPart.CFrame*CFrame.new(0,0,-5))
  25. Clone.Parent = workspace
  26. local CloneAnimation = ReplicatedStorage.Animate:Clone()
  27. CloneAnimation.Parent = Clone
  28. while true do
  29. wait()
  30. if not Clone then
  31. break
  32. elseif CurrentClone == CloneLife then
  33. RemoveClone(plr)
  34. else
  35. wait(0.25)
  36. CurrentClone = CurrentClone + 0.25
  37. Clone.Humanoid:MoveTo(Char.HumanoidRootPart.Position+Vector3.new(0,0,-5))
  38. end
  39. end
  40. end
  41.  
  42. ShadowEvent.OnServerEvent:Connect(function(plr)
  43. CurrentClone = 0
  44. CurrentClone = 0
  45. CloneCharacter(plr)
  46. end)
  47.  
  48.  
  49. local plr = game.Players.LocalPlayer
  50. local Char = script.Parent
  51. local UIS = game:GetService("UserInputService")
  52. local ReplicatedStorage = game:GetService("ReplicatedStorage")
  53. local Key = 'B'
  54. local Debounce = true
  55.  
  56. UIS.InputBegan:Connect(function(Input, IsTyping)
  57. if IsTyping then return end
  58. if Input.KeyCode == Enum.KeyCode[Key] and Debounce then
  59. Debounce = false
  60. ReplicatedStorage.ShadowEvent:FireServer()
  61. wait(2)
  62. Debounce = true
  63. end
  64. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement