Hi all,
I’m looking for a solution to what I believe should be a simple issue, but I can seem to fully wrap my head around why this is occurring. I’ve done some prior research online, and I can’t find any legitimate solution.
Here is the code:
local TS = game:GetService("TweenService")
local PlayerHitboxes = game.Players.LocalPlayer.Character:WaitForChild("HumanoidRootPart")
--Change volume of music
local ManageVolume = function(SoundEffect, VolumeNumber)
TS:Create(SoundEffect, TweenInfo.new(1), {Volume = VolumeNumber}):Play()
end
--Manage main pizzeria hitboxes
for i,v in pairs(game.Workspace.MusicHitboxes:GetChildren()) do
v.Touched:Connect(function(PlayerTouched)
if PlayerTouched == PlayerHitboxes then
ManageVolume(v.MusicVal.Value, 0.75)
end
end)
v.TouchEnded:Connect(function(PlayerTouched)
if PlayerTouched == PlayerHitboxes then
ManageVolume(v.MusicVal.Value, 0)
end
end)
end
(v.MusicVal is an ObjectValue which traces to a Sound found within game.Workspace.Audios)
As the title says, this code is within a LocalScript, but the volume tweens are replicating to all clients instead of only a single player.