Advertisement
DE_Speedruns

View Part Open source for blade ball

Feb 17th, 2024 (edited)
5,552
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.61 KB | None | 0 0
  1. -- Define a global table to simulate getgenv()
  2. local globals = {}
  3. -- Define placeholder for get_plr() if not already defined
  4. local function get_plr()
  5. -- Placeholder implementation, replace with actual logic to get the player object.
  6. return game.Players.LocalPlayer
  7. end
  8. local Range = 10
  9. -- Define IsAlive function if not already defined
  10. local function IsAlive()
  11. -- Placeholder implementation, replace with actual logic to check if the player is alive.
  12. local Alive = workspace:WaitForChild("Alive", 20)
  13. return Alive and Alive:FindFirstChild(get_plr().Name) ~= nil
  14. end
  15. -- Define ViewParryArea function
  16. local function ViewParryArea()
  17. -- Clean up any previous Visual object
  18. local previousVisual = workspace:FindFirstChild("Parry Range")
  19. if previousVisual then
  20. previousVisual:Destroy()
  21. end
  22. -- Create a new Visual part
  23. local Visual = Instance.new("Part", workspace)
  24. Visual.Name = "Parry Range"
  25. Visual.Material = Enum.Material.ForceField
  26. Visual.CastShadow = false
  27. Visual.CanCollide = false
  28. Visual.Anchored = true
  29. Visual.BrickColor = BrickColor.new(1004)
  30. Visual.Shape = Enum.PartType.Ball
  31.  
  32. -- Retrieve the local player
  33. local Players = game:GetService("Players")
  34. local Player = Players.LocalPlayer
  35.  
  36. -- Keep track of the visibility of the parry area
  37. globals.ViewParryArea = true
  38.  
  39. -- Main loop to visualize the parry area
  40. while globals.ViewParryArea do
  41. -- Use a wait time that doesnĂ¢â‚¬â„¢t degrade performance
  42.  
  43. task.wait()
  44. local plrChar = Player.Character or Player.CharacterAdded:Wait()
  45. local plrPP = plrChar:FindFirstChild("HumanoidRootPart") or plrChar.PrimaryPart
  46.  
  47. if plrPP then
  48. Visual.CFrame = CFrame.new(plrPP.Position)
  49. -- Additional logic for determining the Range based on your game's need
  50. Visual.Size = Vector3.new(Range, Range, Range)
  51. if plrChar:FindFirstChild("Highlight") then
  52. Visual.BrickColor = BrickColor.new(1004)
  53. Range = 30
  54. else
  55. Visual.BrickColor = BrickColor.new(1023)
  56. Range = 30
  57. end
  58. -- Position the Visual at the player's position
  59. Visual.Position = plrPP.Position
  60. else
  61. -- If the player does not have a primary part, move the Visual off-screen
  62. Visual.Position = Vector3.new(1000, 1000, 1000)
  63. end
  64. end
  65. end
  66.  
  67. -- Call the ViewParryArea function to activate the parry area visualization
  68. while true do
  69. ViewParryArea()
  70. task.wait()
  71. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement