Skip to content

Commit

Permalink
patch 91 sfx handler (#93)
Browse files Browse the repository at this point in the history
  • Loading branch information
reimakesgames committed Nov 25, 2022
1 parent 32f64ef commit 13c8303
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/client/WeaponClient.client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -482,8 +482,8 @@ UserInputService.InputBegan:Connect(function(input: InputObject, gameProcessedEv
local OriginPosition: Vector3 = (LocalPlayer.Character.HumanoidRootPart.CFrame * HEAD_OFFSET).Position
local LookVector: Vector3 = Camera.CFrame.LookVector

workspace.FireSounds.fire:Play()
workspace.FireSounds.distant:Play()
SFXHandler:PlaySound(workspace.FireSounds.fire)
SFXHandler:PlaySound(workspace.FireSounds.distant)

WeaponFire(OriginPosition, LookVector, random)
WeaponFireSignal:FireServer(OriginPosition, LookVector)
Expand Down
8 changes: 6 additions & 2 deletions src/shared/Modules/SFXHandler.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,21 @@ function SFXHandler:PlaySound(soundObject: Sound, soundSettings: SoundSettings?)
if soundSettings.SoundPosition == false or soundSettings.SoundPosition == nil then
newSound.Parent = ActiveSoundsFolder()
else
QuickInstance("Part", {
local Area = QuickInstance("Part", {
Anchored = true;
CanCollide = false;
CanQuery = false;
CanTouch = false;
Size = soundSettings.SoundSize or Vector3.new(1, 1, 1);
Position = soundSettings.SoundPosition;
Transparency = 1;
Parent = ActiveSoundsFolder()
})
Debris:AddItem(Area, soundObject.TimeLength)
newSound.Parent = Area
end

newSound:Play()
end

return SFXHandler
return SFXHandler

0 comments on commit 13c8303

Please sign in to comment.