Hello. I’ve having some issues with this function. For some reason, the first line of it is erroring, and I can’t figure out why.
function SoundService:ActivateSound(Phase)
--Below Line Errors
local SoundSearch = LocalPlayer.Character:FindFirstChild("Head"):FindFirstChild(Phase) --Error here
if SoundSearch and SoundSearch:IsA("Sound") and SoundSearch.SoundId ~= "rbxassetid://0" then
if SoundSearch.IsLoaded then
SoundSearch:Stop() --Reset
SoundSearch:Play()
else
Tool.ErrorLogger:FireClient(LocalPlayer,"[Green's Weapon System]: Non-Fatal Error - Code x0004-2")
end
else
Tool.ErrorLogger:FireClient(LocalPlayer,"[Green's Weapon System]: Non-Fatal Error - Code x0004-1")
end
end
This is being run in a serverside script. The “local player” is defined here:
script.Parent.GunEquip.OnServerEvent:Connect(function(player,EquipType)
GunEquipted = EquipType
LocalPlayer = player
AnimationService.PreloadAnimation(Tool.Parent:FindFirstChildOfClass("Humanoid"))
SoundService:GenerateRemotePresets()
if EquipType then
SoundService:LoopSound("Idle")
AnimationService:LaunchAnimationByMethod("EquipGun",EquipType)
else
SoundService:BreakLoop("Idle")
AnimationService:Stop()
end
end)
14:47:52.943 Argument 1 missing or nil - Server - CoreHandler:162
I really don’t see what the issue is, and have been stuck on this for ~15 minutes. Anyone know a fix?