Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local ReplicatedStorage = game:GetService("ReplicatedStorage")
- local ShadowEvent = ReplicatedStorage.ShadowEvent
- local function RemoveClone(plr)
- if workspace:FindFirstChild(plr.Name..'Clone') then
- local Clone = workspace[plr.Name..'Clone']
- Clone:Destroy()
- end
- end
- local CurrentClone = 0
- local CloneLife = 60
- local function CloneCharacter(plr)
- local Char = plr.Character or plr.CharacterAdded:Wait()
- Char.Archivable = true
- local Poof = ReplicatedStorage.CloneEffect:Clone()
- Poof.CFrame = Char.HumanoidRootPart.CFrame
- Poof.Parent = workspace
- Poof.ParticleEmitter.Enabled = true
- game:GetService("Debris"):AddItem(Poof, 0.5)
- local Clone = Char:Clone()
- Clone.Name = plr.Name..'Clone'
- Clone:SetPrimaryPartCFrame(Char.HumanoidRootPart.CFrame*CFrame.new(0,0,-5))
- Clone.Parent = workspace
- local CloneAnimation = ReplicatedStorage.Animate:Clone()
- CloneAnimation.Parent = Clone
- while true do
- wait()
- if not Clone then
- break
- elseif CurrentClone == CloneLife then
- RemoveClone(plr)
- else
- wait(0.25)
- CurrentClone = CurrentClone + 0.25
- Clone.Humanoid:MoveTo(Char.HumanoidRootPart.Position+Vector3.new(0,0,-5))
- end
- end
- end
- ShadowEvent.OnServerEvent:Connect(function(plr)
- CurrentClone = 0
- CurrentClone = 0
- CloneCharacter(plr)
- end)
- local plr = game.Players.LocalPlayer
- local Char = script.Parent
- local UIS = game:GetService("UserInputService")
- local ReplicatedStorage = game:GetService("ReplicatedStorage")
- local Key = 'B'
- local Debounce = true
- UIS.InputBegan:Connect(function(Input, IsTyping)
- if IsTyping then return end
- if Input.KeyCode == Enum.KeyCode[Key] and Debounce then
- Debounce = false
- ReplicatedStorage.ShadowEvent:FireServer()
- wait(2)
- Debounce = true
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement