Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function BuyDoor(plr)
- local Price = script.Parent.Parent.Price.Value
- local Owner = script.Parent.Parent.Owner.Value
- local isOwner = plr.leaderstats.isOwner.Value
- if not isOwner then
- if plr.leaderstats.Ru.Value >= Price then
- if Owner == "" then
- plr.leaderstats.Ru.Value -= Price
- script.Parent.Parent.Owner.Value = plr.Name
- plr.leaderstats.BuyedApart.Value = script.Parent.Parent.Door
- script.Parent.SurfaceGui.TextLabel.Text = plr.Name
- plr.leaderstats.isOwner.Value = true
- end
- end
- else
- if plr.leaderstats.Ru.Value >= Price then
- if Owner == "" then
- plr.leaderstats.BuyedApart.Value.Parent.Owner.Value = ""
- plr.leaderstats.BuyedApart.Value.Parent.Part.SurfaceGui.TextLabel.Text = "Квартира "..plr.leaderstats.BuyedApart.Value.Parent.Price.Value
- plr.leaderstats.Ru.Value -= Price
- script.Parent.Parent.Owner.Value = plr.Name
- plr.leaderstats.BuyedApart.Value = script.Parent.Parent.Door
- script.Parent.SurfaceGui.TextLabel.Text = plr.Name
- plr.leaderstats.isOwner.Value = true
- end
- end
- end
- end
- script.Parent.ClickDetector.MouseClick:Connect(BuyDoor)
Advertisement
Add Comment
Please, Sign In to add comment