Advertisement
m9aari

Da strike stuff script

Nov 3rd, 2024 (edited)
323
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. -- Wait for the player's Backpack and required objects
  2. local player = game:GetService("Players").LocalPlayer
  3.  
  4. -- Function to monitor tools and their AMMO
  5. local function monitorTool(tool)
  6. if tool.Name == "db" or tool.Name == "rev" then
  7. local ammoValue = tool:FindFirstChild("AMMO")
  8. local remoteEvent = tool:FindFirstChild("rl")
  9.  
  10. if ammoValue and ammoValue:IsA("NumberValue") and remoteEvent then
  11. -- Function to check AMMO value
  12. local function checkAmmo()
  13. if ammoValue.Value == 0 then
  14. remoteEvent:FireServer() -- Fire the remote event
  15. end
  16. end
  17.  
  18. -- Connect to changes in AMMO's Value
  19. ammoValue:GetPropertyChangedSignal("Value"):Connect(checkAmmo)
  20. else
  21. warn("AMMO value or remote event 'rl' not found in the tool:", tool.Name)
  22. end
  23. end
  24. end
  25.  
  26. -- Listen for tools in Backpack and Character
  27. player.Backpack.ChildAdded:Connect(monitorTool)
  28. player.CharacterAdded:Connect(function(character)
  29. character.ChildAdded:Connect(monitorTool)
  30. end)
  31.  
  32. -- Check for tools already equipped or in the Backpack
  33. for _, item in pairs(player.Backpack:GetChildren()) do
  34. monitorTool(item)
  35. end
  36. if player.Character then
  37. for _, item in pairs(player.Character:GetChildren()) do
  38. monitorTool(item)
  39. end
  40. end
  41.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement