Advertisement
drakon-firestone

EggsClient

Apr 1st, 2023
914
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.07 KB | None | 0 0
  1. local runService = game:GetService("RunService")
  2.  
  3. local replicatedStorage = game:WaitForChild("ReplicatedStorage")
  4. local replicatedFirst = game:WaitForChild("ReplicatedFirst")
  5. local remotes = replicatedStorage:WaitForChild("Remotes")
  6.  
  7. local pets = replicatedFirst:WaitForChild("Pets")
  8.  
  9. local tweenService = game:GetService("TweenService")
  10.  
  11. local player = game.Players.LocalPlayer
  12. local playerGui = player:WaitForChild("PlayerGui")
  13. local screenGui = playerGui:WaitForChild("ScreenGui")
  14. local center = screenGui:WaitForChild("Center")
  15. local petInventory = center:WaitForChild("PetInventory")
  16. local scrollingFrame = petInventory:WaitForChild("ScrollingFrame")
  17. local template = scrollingFrame:WaitForChild("Template")
  18.  
  19. local module3D = require(replicatedStorage:WaitForChild("Module3D"))
  20.  
  21. local maxSelectedPets = 10
  22.  
  23. local selectedPets = 0
  24.  
  25. local function onTemplateClick(clickedTemplate, id)
  26.    
  27.     local equipped = clickedTemplate.Equipped.Value
  28.    
  29.     if not equipped and selectedPets < maxSelectedPets then
  30.         clickedTemplate.Equipped.Value = true
  31.        
  32.         clickedTemplate.BackgroundColor3 = Color3.fromRGB(96,235,36)
  33.        
  34.         selectedPets += 1
  35.        
  36.         remotes.EquipPet:FireServer(clickedTemplate.Name, id)
  37.        
  38.        
  39.         -- TUTAJ DODAJEMY DO ŚCIĄGANIA PETÓW
  40.        
  41.        
  42.        
  43.        
  44.         -- TUTAJ KONIEC
  45.     end
  46.    
  47. end
  48.  
  49.  
  50. local function createTemplate(petName, id)
  51.     local newTemplate = template:Clone()
  52.     newTemplate.Name = petName
  53.     newTemplate.Visible = true
  54.     newTemplate.Parent = scrollingFrame
  55.     local petModel3D = module3D:Attach3D(
  56.         newTemplate:WaitForChild("Viewport"),
  57.         pets:WaitForChild(petName):Clone())
  58.     petModel3D:SetDepthMultiplier(2)
  59.     petModel3D.CurrentCamera.FieldOfView = 5
  60.     petModel3D.Visible = true
  61.     runService.RenderStepped:Connect(function()
  62.         petModel3D:SetCFrame(
  63.             CFrame.Angles(
  64.                 0,
  65.                 tick() % (math.pi * 2), 0) * CFrame.Angles(math.rad(-10), 0, 0))
  66.     end)
  67.     newTemplate.MouseButton1Click:Connect(function()
  68.         onTemplateClick(newTemplate, id)
  69.     end)
  70. end
  71.  
  72.  
  73. remotes:WaitForChild("CreateTemplate").OnClientEvent:Connect(function(name, id)
  74.     createTemplate(name, id)
  75. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement