Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local runService = game:GetService("RunService")
- local replicatedStorage = game:WaitForChild("ReplicatedStorage")
- local replicatedFirst = game:WaitForChild("ReplicatedFirst")
- local remotes = replicatedStorage:WaitForChild("Remotes")
- local pets = replicatedFirst:WaitForChild("Pets")
- local tweenService = game:GetService("TweenService")
- local player = game.Players.LocalPlayer
- local playerGui = player:WaitForChild("PlayerGui")
- local screenGui = playerGui:WaitForChild("ScreenGui")
- local center = screenGui:WaitForChild("Center")
- local petInventory = center:WaitForChild("PetInventory")
- local scrollingFrame = petInventory:WaitForChild("ScrollingFrame")
- local template = scrollingFrame:WaitForChild("Template")
- local module3D = require(replicatedStorage:WaitForChild("Module3D"))
- local maxSelectedPets = 10
- local selectedPets = 0
- local function onTemplateClick(clickedTemplate, id)
- local equipped = clickedTemplate.Equipped.Value
- if not equipped and selectedPets < maxSelectedPets then
- clickedTemplate.Equipped.Value = true
- clickedTemplate.BackgroundColor3 = Color3.fromRGB(96,235,36)
- selectedPets += 1
- remotes.EquipPet:FireServer(clickedTemplate.Name, id)
- -- TUTAJ DODAJEMY DO ŚCIĄGANIA PETÓW
- -- TUTAJ KONIEC
- end
- end
- local function createTemplate(petName, id)
- local newTemplate = template:Clone()
- newTemplate.Name = petName
- newTemplate.Visible = true
- newTemplate.Parent = scrollingFrame
- local petModel3D = module3D:Attach3D(
- newTemplate:WaitForChild("Viewport"),
- pets:WaitForChild(petName):Clone())
- petModel3D:SetDepthMultiplier(2)
- petModel3D.CurrentCamera.FieldOfView = 5
- petModel3D.Visible = true
- runService.RenderStepped:Connect(function()
- petModel3D:SetCFrame(
- CFrame.Angles(
- 0,
- tick() % (math.pi * 2), 0) * CFrame.Angles(math.rad(-10), 0, 0))
- end)
- newTemplate.MouseButton1Click:Connect(function()
- onTemplateClick(newTemplate, id)
- end)
- end
- remotes:WaitForChild("CreateTemplate").OnClientEvent:Connect(function(name, id)
- createTemplate(name, id)
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement