Currently, I am trying to set my effects on the client with the :FireAllClients connection. The problem is the action performs just right, but nothing is actually working as intended. Here is the onClientEvent handler
OnClientEvent:
repStorage:WaitForChild"Remotes".Events.ClientFX.OnClientEvent:Connect(function(a,b,c)
if not lp.Character or (lp.Character and not lp.Character:FindFirstChild"HumanoidRootPart") then return end
local hrp = lp.Character:FindFirstChild"HumanoidRootPart"
if clientFX[a] then
utilityLib.pcall(function()
clientFX[a](b)
end)
elseif clientFunctions[a] then
utilityLib.pcall(function()
clientFunctions[a](b)
end)
end
end)
From what I can make out, when you do FireAllClients, you pass in the Origin as a player character’s HumanoidRootPart.
Is it possible that when the sound is created, it gets parented to a completely different player character which causes it to not be heard? Try adding a print statement that prints out the sound’s parent before it plays to test this.
If this is the case, I would rewrite it like so:
for _, player in pairs(game.Players:GetPlayers()) do
if player.Character == nil then
continue -- If a player has resetted and their character is nil, skip
end
ClientFX:FireClient(player, "PlaySound",{Sound = "Swing".. utilityLib.getRandom(1,2),Origin = player.Character.HumanoidRootPart}
end
This issue applies to all functions. I have a module that pickups the OnClientEvent parameter and runs it. the problem is is that the function never actually works. Like taking damage or whatever.