Advertisement
GigaOrts

Untitled

Jul 3rd, 2025
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.31 KB | None | 0 0
  1. button = script.Parent.ShopButton
  2. PassFrame = script.Parent.Frame
  3. function plus()
  4.     PassFrame.Visible = not PassFrame.Visible
  5. end
  6. button.MouseButton1Click:Connect(plus)
  7.  
  8. -----------------------------------------------------------
  9.  
  10.  
  11.  
  12. local ServerStorage = game:GetService("ServerStorage")
  13. local ReplicatedStorage = game:GetService("ReplicatedStorage")
  14. local GiveWeaponEvent = ReplicatedStorage:WaitForChild("GiveWeapon")
  15.  
  16. function onEvent1(player, gunName)
  17.     local backpack = player:WaitForChild("Backpack")
  18.     local Gun = ServerStorage:FindFirstChild("Weapons"):FindFirstChild(gunName)
  19.     local clone = Gun:Clone()
  20.     clone.Parent = backpack
  21. end
  22.  
  23. GiveWeaponEvent.OnServerEvent:Connect(onEvent1)
  24.  
  25. -------------------------------------------------------------
  26.  
  27.  
  28. local player = game.Players.LocalPlayer
  29. local ReplicatedStorage = game:GetService("ReplicatedStorage")
  30. local GiveWeaponEvent = ReplicatedStorage:WaitForChild("GiveWeapon")
  31. local gunName = script.Parent.Name
  32. local Frame = script.Parent.Parent
  33.  
  34. script.Parent.MouseButton1Down:Connect(function()
  35.     Frame.Visible = false
  36.     GiveWeaponEvent:FireServer(gunName)
  37. end)
  38.  
  39. --------------------------------------------------------------
  40.  
  41.  
  42. script.Parent.Humanoid.Died:Connect(function()
  43.     print("NPC уничтожен")
  44.     wait(3)
  45.     script.Parent:Destroy()
  46. end)
  47.  
  48.  
  49.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement