Advertisement
drakon-firestone

Untitled

Nov 10th, 2023
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.61 KB | None | 0 0
  1. local players = game:GetService("Players")
  2.  
  3. local pets = game.ReplicatedFirst.Pets
  4. local playersFolder = workspace.Players
  5.  
  6. local createTemplate =
  7. game.ReplicatedStorage:WaitForChild("Remotes"):WaitForChild("CreateTemplate")
  8.  
  9.  
  10. players.PlayerAdded:Connect(function(player)
  11.  
  12. local folder = Instance.new("Folder")
  13. folder.Name = player.Name
  14. folder.Parent = playersFolder
  15.  
  16. for i = 1,20,1 do
  17.  
  18. --local newPet = pets[i]:Clone()
  19. --newPet.Parent = folder
  20.  
  21. createTemplate:FireClient(player, pets[i].Name, i)
  22. end
  23.  
  24. end)
  25.  
  26.  
  27. game.ReplicatedStorage.Remotes.EquipPet.OnServerEvent:Connect(function(player,petName, id)
  28. local petModel = game.ReplicatedFirst.Pets:FindFirstChild(petName):Clone()
  29. petModel.Parent = workspace.Players:WaitForChild(player.Name)
  30. petModel.Id.Value = id
  31. end)
  32.  
  33.  
  34. game.ReplicatedStorage.Remotes.UnequipPet.OnServerEvent:Connect(function(player, petName, id)
  35.  
  36. local playerFolder = workspace.Players:FindFirstChild(player.Name)
  37.  
  38. for i, pet in pairs(playerFolder:GetChildren()) do
  39.  
  40. if pet.Id.Value == id then -- znaleziony pet do usunięcia
  41. pet:Destroy()
  42. end
  43.  
  44. end
  45.  
  46.  
  47. end)
  48.  
  49.  
  50.  
  51. for _, item in pairs(workspace.Areas:GetDescendants()) do
  52. if item.Name == "Barrier" then
  53. item.Attachment.ProximityPrompt.Triggered:Connect(function(player)
  54. if player.leaderstats.Coins.Value >= item.AreaPrice.Value then
  55. player.leaderstats.Coins.Value -= item.AreaPrice.Value
  56. local area = Instance.new("StringValue", player.Areas)
  57. area.Name = item.Parent.Name
  58. game.ReplicatedStorage.Remotes.Area:FireClient(player, item)
  59. end
  60. end)
  61. end
  62. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement