Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local RunService = game:GetService("RunService")
- wait(1)
- local part = Instance.new("Part", workspace)
- part.Position = game.Players.LocalPlayer.Character.Head.Position + Vector3.new(0,10,0)
- part.Touched:Connect(function(hit)
- if hit.Parent ~= workspace and hit.Parent:FindFirstChildOfClass("Humanoid") and hit.Parent:FindFirstChild("Dying") == nil and hit.Parent:FindFirstChildOfClass("Humanoid").Health > 0 then
- local a = Instance.new("IntValue", hit.Parent)
- a.Name="Dying"
- local savedo = part.Orientation
- local weld = Instance.new("WeldConstraint")
- if part.Anchored == false then
- weld.Parent = hit
- weld.Part0 = hit
- weld.Part1 = part
- end
- local hum = hit.Parent:FindFirstChild("Humanoid")
- hum.WalkSpeed = 0
- hum.JumpPower = 0
- hum.HipHeight = 0
- local sound = Instance.new("Sound", script.Parent)
- sound.Volume = 4
- sound.SoundId = "rbxassetid://165796875"
- sound.Parent = hit.Parent.Torso
- sound:Play()
- local ActiveTracks = hum:GetPlayingAnimationTracks()
- for _,v in pairs(ActiveTracks) do
- v:Stop()
- end
- local char = hit.Parent
- local bodyparts = char:GetChildren()
- for i, bodypart in pairs (bodyparts) do
- if bodypart:FindFirstChild("IsElectrocuted") == nil then
- local b = Instance.new("IntValue", bodypart)
- b.Name="IsElectrocuted"
- end
- end
- local everypart = char:GetDescendants()
- for i, part in pairs(everypart) do
- if part.ClassName=="Shirt" or part.ClassName=="Pants" or part.ClassName=="ShirtGraphic" or part.ClassName=="Decal" then
- part:Destroy()
- end
- if part:IsA("BasePart") then
- part.Color = Color3.fromRGB(0,0,0)
- part.Material="Slate"
- end
- if part:FindFirstChildOfClass("SpecialMesh") then
- local mesh = part:FindFirstChildOfClass("SpecialMesh")
- mesh.TextureId=""
- end
- if part.ClassName=="CharacterMesh" then
- part.OverlayTextureId = 0
- end
- end
- local joints = char.Torso:GetChildren()
- for i, joint in pairs(joints) do
- if joint.ClassName=="Motor6D" then
- joint.C0 = joint.C0 * CFrame.fromEulerAnglesXYZ(math.random(-50,50)/100,math.random(-50,50)/100,math.random(-50,50)/100)
- end
- end
- for i = 1, 51 do
- wait(.001)
- if char.HumanoidRootPart:FindFirstChild("RootJoint") ~= nil then
- char.HumanoidRootPart.RootJoint.C0 = char.Torso.Neck.C0 * CFrame.fromEulerAnglesXYZ(math.random(-25,25)/100,math.random(-25,25)/100,math.random(-25,25)/100)
- end
- for i, joint in pairs(joints) do
- if joint.ClassName=="Motor6D" then
- joint.C0 = joint.C0 * CFrame.fromEulerAnglesXYZ(math.random(-10,10)/100,math.random(-10,10)/100,math.random(-10,10)/100)
- end
- end
- end
- weld:Destroy()
- hum.PlatformStand = true
- part.Orientation = savedo
- sound:Destroy()
- wait(.5)
- hum.Health = 0
- if hit.Parent:FindFirstChild("HumanoidRootPart") then
- hit.Parent.HumanoidRootPart.CanCollide = false
- end
- for i, bodypart in pairs (bodyparts) do
- if bodypart:IsA("BasePart") then
- RunService.Heartbeat:Wait()
- bodypart.Velocity = bodypart.Velocity + Vector3.new(math.random(-50,50),50,math.random(-50,50))
- end
- end
- wait(.25)
- a:Destroy()
- elseif hit:FindFirstChild("Dying") == nil and hit.Anchored == false and hit.Name~="HumanoidRootPart" and (hit.CanCollide == true and hit.Transparency ~= 1) and hit:FindFirstChild("IsElectrocuted") == nil and (hit.Material == Enum.Material.Metal or hit.Material == Enum.Material.CorrodedMetal or hit.Material == Enum.Material.Foil or hit.Material == Enum.Material.Grass or hit.Material == Enum.Material.Ice) then
- local a = Instance.new("IntValue", hit)
- a.Name="Dying"
- if hit:FindFirstChild("IsElectrocuted") == nil then
- local b = Instance.new("IntValue", hit)
- b.Name="IsElectrocuted"
- end
- local savedo = part.Orientation
- local a1 = Instance.new("Attachment")
- local a2 = Instance.new("Attachment")
- local r = Instance.new("AlignPosition")
- local r2 = Instance.new("AlignOrientation")
- local weld = Instance.new("WeldConstraint")
- if hit.Parent:FindFirstChild("Humanoid") then
- a1.Parent = hit
- a2.Parent = part
- r.Parent = hit
- r2.Parent = hit
- a1.Position = Vector3.new(0,0,0)
- a1.Name = hit.Name .. " Elec"
- a2.WorldPosition = hit.Position
- a2.Name = hit.Parent.Name .. " Elec"
- a1.WorldOrientation = hit.Orientation
- a2.WorldOrientation = hit.Orientation
- r.Name = hit.Name .. " AlignPositionElec"
- r.Attachment0 = a1
- r.Attachment1 = a2
- r.Responsiveness = 200
- r.RigidityEnabled = false
- r2.Name = hit.Name .. " AlignOrientationElec"
- r2.Attachment0 = a1
- r2.Attachment1 = a2
- r2.Responsiveness = 50
- r2.RigidityEnabled = true
- end
- if hit.Parent:FindFirstChild("Humanoid") == nil then
- weld.Parent = hit
- weld.Part0 = hit
- weld.Part1 = part
- end
- local sound = part.Shock:Clone()
- sound.Parent = hit
- sound:Play()
- if hit:IsA("BasePart") and hit.Material ~= Enum.Material.Ice then
- hit.Color = Color3.fromRGB(0,0,0)
- hit.Material="Slate"
- end
- if hit:FindFirstChildOfClass("SpecialMesh") then
- local mesh = hit:FindFirstChildOfClass("SpecialMesh")
- mesh.TextureId=""
- end
- if hit.ClassName=="MeshPart" then
- hit.TextureID = ""
- end
- for i = 1, 51 do
- wait(.001)
- hit.CFrame = hit.CFrame * CFrame.fromEulerAnglesXYZ(math.random(-25,25)/100,math.random(-25,25)/100,math.random(-25,25)/100)
- end
- a1:Destroy()
- a2:Destroy()
- r:Destroy()
- r2:Destroy()
- weld:Destroy()
- part.Orientation = savedo
- sound:Destroy()
- part.ElectricShock.Enabled = false
- wait(.25)
- a:Destroy()
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement