Advertisement
Sungmingamerpro13

Burger with Stacks

Mar 28th, 2024 (edited)
580
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
CSS 1.36 KB | None | 0 0
  1. function MouseHoverEnter()
  2.     if not script.Parent:FindFirstChild("SelectionBox") then
  3.         local SelectionBox = Instance.new("SelectionBox")
  4.         SelectionBox.Adornee = script.Parent
  5.         SelectionBox.Parent = script.Parent
  6.         SelectionBox.Color3 = Color3.new(1, 1, 1)
  7.         SelectionBox.Transparency = 0.8
  8.         local CashAmount = 5
  9.         script.Parent.CashGui.CashLabel.Text = CashAmount.." Cash"
  10.         script.Parent.CashGui.Enabled = true
  11.     end
  12. end
  13.  
  14. function MouseHoverLeave()
  15.     if script.Parent:FindFirstChild("SelectionBox") then
  16.         script.Parent.SelectionBox:Destroy()
  17.         script.Parent.CashGui.Enabled = false
  18.     end
  19. end
  20.  
  21. function ClickOnPart(player)
  22.     local AddMoney = 5
  23.     if player.Money.Value >= AddMoney then
  24.         player.Money.Value = player.Money.Value - AddMoney
  25.  
  26.         if not player.Backpack:FindFirstChild("Burger") then
  27.             game.ServerStorage.Foods:FindFirstChild("Burger"):Clone().Parent = player.Backpack
  28.         end
  29.     else
  30.         player.Money.Value = player.Money.Value - AddMoney
  31.  
  32.         if player.Backpack:FindFirstChild("Burger") then
  33.             player.Backpack:FindFirstChild("Burger").stacks.Value += 1
  34.         end
  35.     end
  36. end
  37.  
  38. script.Parent.ClickDetector.MouseHoverEnter:Connect(MouseHoverEnter)
  39. script.Parent.ClickDetector.MouseHoverLeave:Connect(MouseHoverLeave)
  40. script.Parent.ClickDetector.MouseClick:Connect(ClickOnPart)
Tags: Roblox
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement