View difference between Paste ID: w8EHzHXv and bWdpC21a
SHOW: | | - or go back to the newest paste.
1
local pl = game:service'Players'.LocalPlayer
2
local chara = pl.Character
3
local hum = chara:FindFirstChildOfClass("Humanoid")
4
hum.MaxHealth = 1000
5
hum.Health = 1000
6
maincol = "White"
7
increment = 20
8
9-
if pl.Name == "CKbackup" then
9+
if pl.Name == "DragonBxllinGamver" then
10
maincol = "Royal purple"
11
end
12
13
script.Parent = pl
14
15
ArtificialHB = Instance.new("BindableEvent", script)
16
ArtificialHB.Name = "Heartbeat"
17
script:WaitForChild("Heartbeat")
18
frame = 0.03333333333333
19
tf = 0
20
allowframeloss = false
21
tossremainder = false
22
lastframe = tick()
23
script.Heartbeat:Fire()
24
game:GetService("RunService").Heartbeat:connect(function(s, p)
25
  tf = tf + s
26
  if tf >= frame then
27
    if allowframeloss then
28
      script.Heartbeat:Fire()
29
      lastframe = tick()
30
    else
31
      for i = 1, math.floor(tf / frame) do
32
        script.Heartbeat:Fire()
33
      end
34
      lastframe = tick()
35
    end
36
    if tossremainder then
37
      tf = 0
38
    else
39
      tf = tf - frame * math.floor(tf / frame)
40
    end
41
  end
42
end)
43
function swait(num)
44
  if num == 0 or num == nil then
45
    ArtificialHB.Event:wait()
46
  else
47
    for i = 0, num do
48
      ArtificialHB.Event:wait()
49
    end
50
  end
51
end
52
53
prevhp = 1000
54
function gethurt(hp)
55
if hp < prevhp then
56
local s = Instance.new("Sound",chara)
57
s.SoundId = "rbxassetid://1055279036"
58
s.Pitch = 1
59
s.Volume = 1
60
s.PlayOnRemove = true
61
s:Destroy()
62
    for _, v in pairs(chara:children()) do
63
      if v:IsA("BasePart") and v.Name ~= "HumanoidRootPart" then
64
        do
65
          local p = v:clone()
66
          p.Name = "trail"
67
          p.Parent = workspace
68
          p.Transparency = 0.5
69
          p.Anchored = true
70
          p.BrickColor = BrickColor.new(maincol)
71
          p.Material = "Neon"
72
          p:BreakJoints()
73
          p.CanCollide = false
74
		  if v == chara.Head then
75
		  for a, b in pairs(p:children()) do
76
		  if b:IsA("Sound") then
77
		  b:Destroy()
78
		  end
79
		  end
80
		  end
81
          coroutine.resume(coroutine.create(function()
82
            for i = 1, 50 do
83
              swait()
84
              p.Transparency = i / 50
85
            end
86
            p:Destroy()
87
          end))
88
        end
89
      end
90
      if v.className == "Accessory" then
91
      end
92
    end
93
end
94
chara.HumanoidRootPart.CFrame = chara.HumanoidRootPart.CFrame + Vector3.new(math.random(-increment,increment),0,math.random(-increment,increment))
95
hum.MaxHealth = 1000
96
hum.Health = 1000
97
prevhp = 1000
98
end
99
100
hum.HealthChanged:connect(gethurt)
101
102
pl.CharacterAdded:connect(function()
103
chara = pl.Character
104
hum = chara:FindFirstChildOfClass("Humanoid")
105
hum.MaxHealth = 1000
106
hum.Health = 1000
107
hum.HealthChanged:connect(gethurt)
108
end)