Advertisement
Vanihgol33

Ant War Auto digging(If you die then stop the creaking)

Feb 26th, 2024
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. local ReplicatedStorage = game:GetService("ReplicatedStorage")
  2. local Player = game:GetService("Players").LocalPlayer
  3.  
  4. local function digBlock()
  5. local targetPosition = Player.Character.HumanoidRootPart.Position + (Player.Character.HumanoidRootPart.CFrame.LookVector * 3)
  6. local args = {[1] = targetPosition}
  7. ReplicatedStorage:WaitForChild("ServerEvents"):WaitForChild("Dig"):FireServer(unpack(args))
  8. end
  9.  
  10. local function startDigging()
  11. while wait(0.1) do
  12. if Player.Character and Player.Character:FindFirstChild("Humanoid") then
  13. digBlock()
  14. end
  15. end
  16. end
  17.  
  18. local function onCharacterAdded(character)
  19. character:WaitForChild("Humanoid").Died:Connect(function()
  20. script:ClearAllChildren()
  21. end)
  22. end
  23.  
  24. Player.CharacterAdded:Connect(onCharacterAdded)
  25. startDigging()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement