Advertisement
Hasli4

RBLX. WeaponHandler

May 15th, 2025
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.12 KB | None | 0 0
  1. -- Для взаимодействия двух скриптов нужно наличие четырёх событий.
  2. local ReplicatedStorage = game:GetService("ReplicatedStorage")
  3. local launchProjectile = ReplicatedStorage:WaitForChild("LaunchProjectile")
  4. local destroyProjectile = ReplicatedStorage:WaitForChild("DestroyProjectile")
  5. local destroyEnemy = ReplicatedStorage:WaitForChild("DestroyEnemy")
  6. local pingChecker = ReplicatedStorage:WaitForChild("Ping")
  7. -- Ссылка на созданный снаряд в ReplicatedStorage
  8. local projectileTemplate = ReplicatedStorage.Projectile
  9.  
  10. -- получаем массу снаряда
  11. local mass = projectile:GetMass()
  12.  
  13. -- перемещаем снаряд в игровой мир
  14. projectile.Parent = game.Workspace
  15. -- функция запускается при уничтожении врага
  16. local function onDestroyEnemy(player, enemy)
  17.     enemy:Destroy()
  18.     -- Добавляем очки за уничтожение врагов в enemyStat лидерборда
  19.     local enemyStat = player.leaderstats:WaitForChild("Score")
  20.     enemyStat.Value = enemyStat.Value + 1
  21. end
  22.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement