Hasli4

RBLX. KingOfTheHill

May 14th, 2025 (edited)
689
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.72 KB | None | 0 0
  1. local Players = game:GetService("Players")
  2. local Hill = script.Parent
  3. local Label = Hill.BillboardGui.TextLabel
  4. local king_name = Hill.KingName
  5.  
  6. local fall_distance = Hill.Size.Magnitude
  7. print("fall_distance:", fall_distance)
  8. local kingdown = true
  9. local position1 = Hill.Position
  10.  
  11. local function onTouch(part)
  12.     if (kingdown) then
  13.         kingdown = false
  14.         king_name.Value = part.Parent.Name
  15.         Label.Text = "Да здравствует король "..king_name.Value.."!"
  16.         local KING = part.Parent.Humanoid
  17.        
  18.         local player = Players:GetPlayerFromCharacter(part.Parent)
  19.         local leaderstats = player.leaderstats
  20.         local crowns = leaderstats and leaderstats:FindFirstChild("Crowns")
  21.        
  22.         local tool_to_destroy = player.Backpack:FindFirstChild("Tool")
  23.         if tool_to_destroy then
  24.             tool_to_destroy:Destroy()
  25.         end
  26.         tool_to_destroy = KING.Parent:FindFirstChild("Tool")
  27.         if tool_to_destroy then
  28.             tool_to_destroy:Destroy()
  29.         end
  30.         while true do
  31.             wait(1)
  32.             KING.BodyDepthScale.Value += 0.06
  33.             KING.HeadScale.Value += 0.04
  34.             KING.BodyWidthScale.Value += 0.04
  35.             KING.BodyHeightScale.Value += 0.01
  36.             KING.WalkSpeed *=0.99
  37.            
  38.             crowns.Value += 1
  39.             local position2 = part.Position
  40.             local distance = (position1 - position2).magnitude
  41.             print("distance:",distance)
  42.             if distance > fall_distance then
  43.                 king_name.Value = ""
  44.                 Label.Text = "Король пал!"
  45.                 KING.BodyDepthScale.Value = 1
  46.                 KING.HeadScale.Value = 1
  47.                 KING.BodyWidthScale.Value = 1
  48.                 KING.BodyHeightScale.Value = 1
  49.                 KING.WalkSpeed = 16
  50.                 kingdown = true
  51.                 local return_tool = game.ReplicatedStorage.Tool:Clone()
  52.                 return_tool.Parent = KING.Parent
  53.                 break
  54.             end
  55.         end
  56.     end
  57.    
  58. end
  59.  
  60. Hill.Touched:Connect(onTouch)
  61.  
Advertisement
Add Comment
Please, Sign In to add comment