WolfGamesProgrammer

Untitled

Mar 29th, 2024
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.13 KB | Source Code | 0 0
  1. function BuyDoor(plr)
  2.     local Price = script.Parent.Parent.Price.Value
  3.     local Owner = script.Parent.Parent.Owner.Value
  4.     local isOwner = plr.leaderstats.isOwner.Value
  5.    
  6.     if not isOwner then
  7.         if plr.leaderstats.Ru.Value >= Price then
  8.             if Owner == "" then
  9.                 plr.leaderstats.Ru.Value -= Price
  10.                 script.Parent.Parent.Owner.Value = plr.Name
  11.                 plr.leaderstats.BuyedApart.Value = script.Parent.Parent.Door
  12.                 script.Parent.SurfaceGui.TextLabel.Text = plr.Name
  13.                 plr.leaderstats.isOwner.Value = true
  14.             end
  15.         end
  16.     else
  17.         if plr.leaderstats.Ru.Value >= Price then
  18.            
  19.             if Owner == "" then
  20.                 plr.leaderstats.BuyedApart.Value.Parent.Owner.Value = ""
  21.                 plr.leaderstats.BuyedApart.Value.Parent.Part.SurfaceGui.TextLabel.Text = "Квартира "..plr.leaderstats.BuyedApart.Value.Parent.Price.Value
  22.                 plr.leaderstats.Ru.Value -= Price
  23.                 script.Parent.Parent.Owner.Value = plr.Name
  24.                 plr.leaderstats.BuyedApart.Value = script.Parent.Parent.Door
  25.                 script.Parent.SurfaceGui.TextLabel.Text = plr.Name
  26.                 plr.leaderstats.isOwner.Value = true
  27.             end
  28.         end
  29.     end
  30. end
  31. script.Parent.ClickDetector.MouseClick:Connect(BuyDoor)
Advertisement
Add Comment
Please, Sign In to add comment