Bu kodda hem ilk ses hemde diğer sesler için ayrı volume ayarları ekle -- Services local…
- User
Bu kodda hem ilk ses hemde diğer sesler için ayrı volume ayarları ekle
-- Services local TweenService = game:GetService("TweenService") local Players = game:GetService("Players") local RunService = game:GetService("RunService")
-- Player ve GUI referansı local player = Players.LocalPlayer local GUI = player:WaitForChild("PlayerGui"):WaitForChild("MainUI")
-- UI Elemanlarının Referansları local TopButtons = GUI:WaitForChild("TopButtons") local Crops = TopButtons:WaitForChild("Crops") local CornIcon = Crops:WaitForChild("CornIcon") local MoneyFrame = TopButtons:WaitForChild("Money"):WaitForChild("Frame") local MoneyIcon = MoneyFrame:WaitForChild("MoneyIcon") local TextLabel = MoneyFrame:WaitForChild("TextLabel")
-- Ses Asset ID'leri local FIRST_SOUND_ASSET_ID = "rbxassetid://1169806635" -- İlk animasyonun başında çalınacak sesin Asset ID'si local OTHER_SOUND_ASSET_ID = "rbxassetid://15675059323" -- Diğer animasyonların başında çalınacak sesin Asset ID'si
-- UI Elemanlarının Orijinal Boyut ve Pozisyonları local uiElements = {MoneyIcon, TextLabel} local originalSizes = {} local originalPositions = {} local activeTweens = {}
for _, uiElement in ipairs(uiElements) do originalSizes[uiElement] = uiElement.Size originalPositions[uiElement] = uiElement.Position activeTweens[uiElement] = nil end
-- Animasyon Fonksiyonları
-- Büyüme animasyonunu oynatan fonksiyon local function playGrowthAnimation(uiElement, sizeIncrease, growDuration, shrinkDuration) -- Aktif bir tween varsa iptal ediyoruz if activeTweens[uiElement] then activeTweens[uiElement]:Cancel() uiElement.Size = originalSizes[uiElement] uiElement.Position = originalPositions[uiElement] end
-- Yeni boyut ve pozisyonu hesaplıyoruz local growSize = originalSizes[uiElement] + sizeIncrease local positionAdjustment = UDim2.new( sizeIncrease.X.Scale / -2, sizeIncrease.X.Offset / -2, sizeIncrease.Y.Scale / -2, sizeIncrease.Y.Offset / -2 ) local growPosition = originalPositions[uiElement] + positionAdjustment -- TweenInfo'ları oluşturuyoruz local growTweenInfo = TweenInfo.new(growDuration, Enum.EasingStyle.Quad, Enum.EasingDirection.Out) local shrinkTweenInfo = TweenInfo.new(shrinkDuration, Enum.EasingStyle.Quad, Enum.EasingDirection.In) -- Tween'leri oluşturuyoruz local growTween = TweenService:Create(uiElement, growTweenInfo, {Size = growSize, Position = growPosition}) local shrinkTween = TweenService:Create(uiElement, shrinkTweenInfo, {Size = originalSizes[uiElement], Position = originalPositions[uiElement]}) -- Büyüme tamamlandığında küçülme animasyonunu başlatıyoruz growTween.Completed:Connect(function() activeTweens[uiElement] = shrinkTween shrinkTween:Play() end) -- Küçülme tamamlandığında aktif tween'i sıfırlıyoruz shrinkTween.Completed:Connect(function() if activeTweens[uiElement] == shrinkTween then activeTweens[uiElement] = nil end uiElement.Size = originalSizes[uiElement] uiElement.Position = originalPositions[uiElement] end) -- Tween'i aktif olarak kaydediyoruz ve başlatıyoruz activeTweens[uiElement] = growTween growTween:Play() - Assistant