dozik_clozik

dodge if hp changed (beta)

Feb 9th, 2024
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.05 KB | Gaming | 0 0
  1. local player = game.Players.LocalPlayer
  2. local part = Instance.new("Part", game:GetService("ReplicatedStorage"))
  3. local part2 = Instance.new("Part", game:GetService("ReplicatedStorage"))
  4. part2.Name = "part2"
  5. part2.Anchored = true
  6. part.Anchored = true
  7. local char = player.Character or player.CharacterAdded:Wait()
  8. local hrt = char:WaitForChild("HumanoidRootPart")
  9. local humanoid= char:WaitForChild("Humanoid")
  10. if humanoid and hrt then
  11.     humanoid:GetPropertyChangedSignal("Health"):Connect(function()
  12.         local random = math.random(1,2)
  13.         if random == 1 then
  14.         local clone = part:Clone()
  15.         clone.Parent = workspace
  16.         clone:PivotTo(hrt.CFrame * CFrame.new(-10,0,0))
  17.        
  18.         wait()
  19.        
  20.         hrt.CFrame = clone.CFrame
  21.         wait()
  22.         clone:Destroy()
  23.         end
  24.         if random == 2 then
  25.                 local random = math.random(1,2)
  26.                 if random == 1 then
  27.                     local clone2 = part2:Clone()
  28.                     clone2.Parent = workspace
  29.                     clone2:PivotTo(hrt.CFrame * CFrame.new(10,0,0))
  30.  
  31.                     wait()
  32.  
  33.                     hrt.CFrame = clone2.CFrame
  34.                     wait()
  35.                     clone2:Destroy()
  36.         end
  37.             end
  38.     end)
  39. end
Tags: Roblox lua Script
Advertisement
Add Comment
Please, Sign In to add comment