Advertisement
xmaanzach

CarShop [Basic Tutorial]

Apr 25th, 2018
1,432
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. local player = game.Players.LocalPlayer
  2. local car1 = game.ReplicatedStorage.Cars.BasicCar
  3. local button = script.Parent.BasicCar
  4. local leaderstats = player:WaitForChild("leaderstats").Cash
  5. local Character = player.Character
  6.  
  7. price1 = 50 -- 50 es el precio del primer auto
  8. debounce = false
  9.  
  10. button.MouseButton1Click:connect(function()
  11. local CloneVehicle1 = car1:Clone()
  12. local frame = script.Parent
  13. if not debounce then
  14. debounce = true
  15. if price1 == 50 then
  16. if leaderstats.Value < price1 then
  17. print("No tienes dinero")
  18. end
  19. if leaderstats.Value >= price1 then
  20. print("Auto Comprado")
  21. CloneVehicle1.Parent = workspace
  22. CloneVehicle1.PrimaryPart = CloneVehicle1.Main
  23. CloneVehicle1:SetPrimaryPartCFrame(Character.Head.CFrame)
  24. CloneVehicle1:MakeJoints()
  25. leaderstats.Value = leaderstats.Value - price1
  26. frame.Visible = false
  27. end
  28. end
  29. debounce = false
  30. end
  31. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement