Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Для взаимодействия двух скриптов нужно наличие четырёх событий.
- local ReplicatedStorage = game:GetService("ReplicatedStorage")
- local launchProjectile = ReplicatedStorage:WaitForChild("LaunchProjectile")
- local destroyProjectile = ReplicatedStorage:WaitForChild("DestroyProjectile")
- local destroyEnemy = ReplicatedStorage:WaitForChild("DestroyEnemy")
- local pingChecker = ReplicatedStorage:WaitForChild("Ping")
- -- Ссылка на созданный снаряд в ReplicatedStorage
- local projectileTemplate = ReplicatedStorage.Projectile
- -- получаем массу снаряда
- local mass = projectile:GetMass()
- -- перемещаем снаряд в игровой мир
- projectile.Parent = game.Workspace
- -- функция запускается при уничтожении врага
- local function onDestroyEnemy(player, enemy)
- enemy:Destroy()
- -- Добавляем очки за уничтожение врагов в enemyStat лидерборда
- local enemyStat = player.leaderstats:WaitForChild("Score")
- enemyStat.Value = enemyStat.Value + 1
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement