Advertisement
m9aari

anti knock

Nov 30th, 2024
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. -- LocalScript
  2.  
  3. -- Wait for the player
  4. local player = game.Players.LocalPlayer
  5.  
  6. -- Function to set up the "Knocked" reset behavior
  7. local function setupKnockedListener(character)
  8. local knockedValue = character:WaitForChild("Knocked")
  9.  
  10. -- Ensure "Knocked" resets to false whenever it's set to true
  11. knockedValue:GetPropertyChangedSignal("Value"):Connect(function()
  12. if knockedValue.Value == true then
  13. knockedValue.Value = false
  14. end
  15. end)
  16. end
  17.  
  18. -- Listen for the player's character to be added
  19. player.CharacterAdded:Connect(function(character)
  20. setupKnockedListener(character)
  21. end)
  22.  
  23. -- If the character already exists when the script starts
  24. if player.Character then
  25. setupKnockedListener(player.Character)
  26. end
  27.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement