audio
This commit is contained in:
1 parent
5c91f5f61d
commit
d0f85a5fa8
3 files changed
+31
No files matched your search
@@ -0,0 +1,29 @@
|
||||
--!strict
|
||||
local Players = game:GetService("Players")
|
||||
local ReplicatedStorage = game:GetService("ReplicatedStorage")
|
||||
local Sounds = require(ReplicatedStorage:WaitForChild("SniperEffects") :: ModuleScript)
|
||||
|
||||
local playerGui = Players.LocalPlayer:WaitForChild("PlayerGui")
|
||||
local bound: {[GuiButton]: boolean} = setmetatable({}, {__mode = "k"})
|
||||
|
||||
local function bindButton(instance: Instance)
|
||||
if not instance:IsA("GuiButton") or bound[instance] then return end
|
||||
local button = instance
|
||||
bound[button] = true
|
||||
|
||||
button.MouseEnter:Connect(function()
|
||||
if button.Active and button.Interactable and button:IsDescendantOf(playerGui) then
|
||||
Sounds.sound("ButtonHover")
|
||||
end
|
||||
end)
|
||||
button.Activated:Connect(function()
|
||||
if button:IsDescendantOf(playerGui) then
|
||||
Sounds.sound("ButtonPress")
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
playerGui.DescendantAdded:Connect(bindButton)
|
||||
for _, instance in playerGui:GetDescendants() do
|
||||
bindButton(instance)
|
||||
end
|
||||
@@ -41,6 +41,8 @@ local SOUNDS: { [string]: SoundDef } = {
|
||||
StreakAccent = { id = "rbxassetid://3120909354", volume = 0.5, speed = 1, near = 0, far = 0, group = "Kill" }, -- Level_up
|
||||
ReloadReady = { id = "rbxassetid://15675085146", volume = 0.24, speed = 1.15, near = 0, far = 0, group = "Reload", cut = 0.19 },
|
||||
RoundCountdown = { id = "rbxassetid://113416294133952", volume = 0.48, speed = 1, near = 0, far = 0, group = "HUD" }, -- timer tick
|
||||
ButtonHover = { id = "rbxassetid://84648433095796", volume = 0.22, speed = 1, near = 0, far = 0, group = "HUD" },
|
||||
ButtonPress = { id = "rbxassetid://121882355123711", volume = 0.27, speed = 1, near = 0, far = 0, group = "HUD" },
|
||||
HotPointStart = { id = "rbxassetid://2789428506", volume = 0.35, speed = 1, near = 0, far = 0, group = "HUD" }, -- Unlock_phoenix
|
||||
HotPointCaptured = { id = "rbxassetid://4612374036", volume = 0.4, speed = 1, near = 0, far = 0, group = "HUD" }, -- bling_big_diamond_pickup
|
||||
MoneyCollect1 = { id = "rbxassetid://84894146013271", volume = 0.15, speed = 1, near = 0, far = 0, group = "Pickup", cut = 0.16 },
|
||||
|
||||
Reference in new issue
Block a user