13
This commit is contained in:
1 parent
d0f85a5fa8
commit
38e4e1c302
5 files changed
+156
-3
No files matched your search
@@ -4,6 +4,23 @@ local ReplicatedStorage = game:GetService("ReplicatedStorage")
|
||||
local Sounds = require(ReplicatedStorage:WaitForChild("SniperEffects") :: ModuleScript)
|
||||
|
||||
local playerGui = Players.LocalPlayer:WaitForChild("PlayerGui")
|
||||
local hoverDef = Sounds.SOUNDS.ButtonHover
|
||||
local hover = Instance.new("Sound")
|
||||
hover.Name = "SniperButtonHover"
|
||||
hover.SoundId = hoverDef.id
|
||||
hover.PlaybackSpeed = hoverDef.speed
|
||||
hover.Parent = game:GetService("SoundService")
|
||||
script.Destroying:Once(function() hover:Destroy() end)
|
||||
|
||||
local function playHover()
|
||||
if not hover.IsLoaded then return end
|
||||
local volume = hoverDef.volume * math.max(Sounds.setting("VolMaster", 1), 0)
|
||||
* math.max(Sounds.setting("Vol" .. hoverDef.group, 1), 0)
|
||||
if volume <= 0 then return end
|
||||
hover:Stop()
|
||||
hover.Volume = volume
|
||||
hover:Play()
|
||||
end
|
||||
local bound: {[GuiButton]: boolean} = setmetatable({}, {__mode = "k"})
|
||||
|
||||
local function bindButton(instance: Instance)
|
||||
@@ -13,7 +30,7 @@ local function bindButton(instance: Instance)
|
||||
|
||||
button.MouseEnter:Connect(function()
|
||||
if button.Active and button.Interactable and button:IsDescendantOf(playerGui) then
|
||||
Sounds.sound("ButtonHover")
|
||||
playHover()
|
||||
end
|
||||
end)
|
||||
button.Activated:Connect(function()
|
||||
|
||||
Reference in new issue
Block a user